ECharts.jl icon indicating copy to clipboard operation
ECharts.jl copied to clipboard

Create global object for graph settings(?)

Open randyzwitch opened this issue 7 years ago • 1 comments
trafficstars

Thinking about creating a global for settings such as size, theme, display type, etc.

randyzwitch avatar Jan 23 '18 15:01 randyzwitch

Per Slack

Randy Zwitch [3:37 PM]
is there a recommended way to have a global settings object for a package?
that users can update
for example, for a plotting package, allowing a user to set that the rendering should be 500x300px, canvas rendered, with black and white theme (where keys are package specific of course)

David Sanders [3:43 PM]
I think the most recommended way would be to have a Settings struct, and pass around the instance to all relevant functions.

Randy Zwitch [3:46 PM]
would I have to worry about doing `deepcopy()` or similar? I’m thinking that if I changed the global settings, I would only want them to apply going forward
meaning, I re-ran a function to get its output

Chris Rackauckas [4:35 PM]
Or use environment variables.

Chris Rackauckas [4:35 PM]
Or use environment variables in an init function to build a settings struct.

randyzwitch avatar Feb 18 '18 23:02 randyzwitch