TanTayBui / flot

Automatically exported from code.google.com/p/flot
MIT License
0 stars 0 forks source link

grid markings in json options data #692

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have to use dynamic generated options data, so I use json files for my 
options definition.
This works fine, but in addition I have to display grid markings for weekends.
So I use the function weekendAreas for my gridmarkings as described in many 
examples.
But as grid configuration has to be defined in options data, I tried to define 
it in json file like this:

"grid": { "markings": weekendAreas }

Where weekendAreas is the function to return the markings data.
But this does not work - No graph is being displayed.

How can this be solved?

Thanks,
Werner

Original issue reported on code.google.com by WernerSc...@gmail.com on 26 Apr 2012 at 6:10

GoogleCodeExporter commented 9 years ago
This isn't a Flot issue; JSON is designed to describe data, independent of any 
language, and has no real support for functions.

The general solution is to add those options before creating the plot; for 
example:

var options = getDynamicJSONOptions();
options.grid.markings = weekendAreas;
$.plot(...

Original comment by dnsch...@gmail.com on 30 Apr 2012 at 12:28

GoogleCodeExporter commented 9 years ago
Thanks. I solved this by creating the options data in the external script that 
creates the json data. 

Original comment by WernerSc...@gmail.com on 2 May 2012 at 12:15