Jump to content
JChartFX Community
  • 0

Getting series by name possible?


Groover

Question

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

  • 0

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 

Link to comment
Share on other sites

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...