jQuery UI Widgets › Forums › Chart › Series – dataField
Tagged: chart, color, jqxChart, series, seriesGroups
This topic contains 3 replies, has 2 voices, and was last updated by Dimitar 11 years, 2 months ago.
-
AuthorSeries – dataField Posts
-
Hi jQWidgets,
I have created a spline chart showing 3 series: max, min, avg.
I want to have check boxes that swap views (similar to the gauge settings with checkbox demo) so users can select a series: only avg, or just min & max or all three.
I created three setting variables that load three different seriesGroups and series.dataFields but this seems a heavy method, re-loading the whole chart settings every time., I’d also like the screen not to refresh, just the series line to show or hide.
Is there a syntax to get to just the series and dataField property so I can only amend the series and its dataField ?
Also while I’m here, I can’t find the part of the API to change the color of the line in a spline chart – what am I staring at and not seeing ?!
Thanks
RCW
Hello RCW,
Unfortunately, updating the seriesGroups property is the only way to achieve this functionality.
As for the colours, please set either the colorScheme property of the entire chart or the color property of each series.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Thanks for the response Dimitar.
If I can get to the series through seriesGroup that will be OK.
I’ve used the flipchart and greyscale code as a basis to work from but I think I’m failing because of my poor syntax – I’m still getting up to pace with javascript/jquery.
As an example: I want to load the graph with default data which have 3 dataFields (hi, lo, avg) in a single series. Then a checkbox swaps between showing only the hi & lo series or only the avg series. I’m only loading a single seriesGroup.
Can I create a variable to hold the series like this:
var hilo = seriesGroup[0].series[0].datafield = “hi”, seriesGroup[0].series[1].datafield = “lo”
then pass this to the chart object:
$(‘#jqxChart’).jqxChart({ seriesGroup[0].series: hilo });
I know I can do this OK:
var groups = $(‘#jqxChart’).jqxChart(‘seriesGroups’);
groups[0].series[0].dataField = hi, groups[0].series[1].dataField = loBut I’m lost trying to pass this to the chart after a refresh. I’m not sure if I’m taking the right approach or using the right syntax.
I guess I’ll need to change the data source at the same time as I change the series and I think I still need a routine in the checkbox to change back to the default too
I appreciate greyscale is a boolean property in the sample so works differently. Would be great if you added a visible: true/false function to the series, then would only need a single load of a series and data. Switching a series on or off is a high priority in a lot of the graphs I’m working on.
Any help or pointers appreciated.
Thanks
RCW
Hi RCW,
As you can see in the Flip Chart demo, the values of the seriesGroups properties are updated when the chart is refreshed.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.