I had an example of a basic line chart working. I have tried to modify it to support multiple series, which can be changed depending on a selection made by the user. In doing my research, it appears that in order to support multiple series, all the data must be returned in the same record (e.g. fields named 'data1', 'data2', etc.). Since the situation I am dealing w/ is dynamic, and I won't know if I will have 1 or 100 series to display, I return all the different data points for each series in one complex property, instead of flattening it out in the record (by using 'data1', 'data2', etc.).
And my code for my series (with the different options I have tried unsuccessfully to use for yField) is:
Can anyone tell me the proper syntax that I should be using in order to the value for the yField read correctly?
How to bind yField of Line Series to complex property?
My data has the following format:
Code:
{
id: 123,
title: 'some title',
date: 1410048000000
series: {
data1: 12,
data2: 25
}
}
And my code for my series (with the different options I have tried unsuccessfully to use for yField) is:
Code:
var label = 'data1';
var series = {
type: 'line',
axis: 'left',
title: label,
xField: 'date',
yField: 'series["' + label + '"]' // DOES NOT WORK
// yField: 'series[' + label + ']' // DOES NOT WORK
// yField: 'series.' + label // DOES NOT WORK
};
Can anyone tell me the proper syntax that I should be using in order to the value for the yField read correctly?
Thank you.
How to bind yField of Line Series to complex property?
Aucun commentaire:
Enregistrer un commentaire