Groover Posted November 12, 2013 Report Share Posted November 12, 2013 Hi, Is it possible to get series by its name instead of getItem(N)? ---------------------------------------------- var seriesList = chart1.getSeries(); var series1 = seriesList.getItem(0); //HIGH var series2 = seriesList.getItem(1); //LOW var series3 = seriesList.getItem(2); //AVG series1.setPane(pane0); series2.setPane(pane0); series3.setPane(pane0); series1.setGallery(cfx.Gallery.Scatter); series2.setGallery(cfx.Gallery.Scatter); series3.setGallery(cfx.Gallery.Curve); -------------------------------------------------------- The sequence of the properties can vary over time in the JSON object used for feeding the chart in my case. Thanks! Quote Link to comment Share on other sites More sharing options...
0 JuanC Posted November 12, 2013 Report Share Posted November 12, 2013 We do not provide a method to find a series by name, but we do provide the text property so you can loop through the series elements and find the field used for each series. var items = [{"Month":"Jan", "V1":15, "V2":12},{"Month":"Feb", "V1":9, "V2":11},{"Month":"Mar", "V1":18, "V2":16}]; chart1.setDataSource(items); alert(chart1.getSeries().getItem(0).getText()); alert(chart1.getSeries().getItem(1).getText()); This code will show V1 and then V2 as alerts. JuanC Quote Link to comment Share on other sites More sharing options...
0 Groover Posted November 12, 2013 Author Report Share Posted November 12, 2013 Thanks JuanC, this is good enough to make it work. Quote Link to comment Share on other sites More sharing options...
Question
Groover
Hi,
Is it possible to get series by its name instead of getItem(N)?
----------------------------------------------
var seriesList = chart1.getSeries();
var series1 = seriesList.getItem(0); //HIGH
var series2 = seriesList.getItem(1); //LOW
var series3 = seriesList.getItem(2); //AVG
series1.setPane(pane0);
series2.setPane(pane0);
series3.setPane(pane0);
series1.setGallery(cfx.Gallery.Scatter);
series2.setGallery(cfx.Gallery.Scatter);
series3.setGallery(cfx.Gallery.Curve);
--------------------------------------------------------
The sequence of the properties can vary over time in the JSON object used for feeding the chart in my case.
Thanks!
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.