Stacked Column Chart with a class field List<>
In the example Stacked Column Chart you are using class fields for axisY, but what if I don't know the number of fields, then I use a List, but how to build a Stacked Column Chart, from a list, for example like this:
class DataModel {
final String date;
final List<SomeData> list;
}
class SomeData {
final String name;
final int count;
}
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
DD
Dharanidharan Dharmasivam
Syncfusion Team
July 14, 2021 04:50 PM UTC
Hi Evgenii,
Greetings from Syncfusion. We have analyzed your scenario with the provided data source structure and created a sample based on this. The sample can be found below, kindly ensure does it meets your requirement. If we have misunderstood your query, kindly get back tous with more information on your scenario.
Thanks,
Dharani.
EV
Evgenii
July 15, 2021 08:24 AM UTC
Thanks for answer, Dharani, but I need a little different, something like this:
final List<SampleData> sampleData = <SampleData>[
SampleData('name1', 50),
SampleData('name2', 25),
SampleData('name3', 42), //that all is first chart, every new SampleData, new chart on yAxis
SampleData('name4', 13),
SampleData('name5', 20),
];
final List<SampleData> sampleData2 = <SampleData>[
SampleData('name1', 40),
SampleData('name2', 30),
SampleData('name3', 20), // that all is second chart
SampleData('name4', 10),
SampleData('name5', 20),
];
final List<ChartSample> chartData = <ChartSample>[
ChartSample(1, sampleData),
ChartSample(2, sampleData2),
];
DP
Dharanitharan Palanisamy
Syncfusion Team
July 17, 2021 07:24 AM UTC
Hi Evgenii,
We have looked over your scenario and the code snippet, unfortunately we are still not sure what you are expecting. Because the above code snippet is for binding data with a string attribute name, it is also noted that it is for charts 1 and 2. We would like to know if you want to bind data for separate charts or different series inside the same chart. Also, for the x-axis, the chartData variable is populated with numeric data. So, because we don't know the specifics of your situation, we developed and sent a suspecting sample; please respond with detail information if this does not meet your needs. We made the sample by putting distinct data for two different series in the same chart and linking the data to the series with a map.
Sample: https://www.syncfusion.com/downloads/support/forum/167195/ze/F167195_stacked_list-1093700407
Thanks,
Dharanitharan. P
Marked as answer
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
- Marked answer
-
EV Evgenii
- Jul 13, 2021 03:18 PM UTC
- Jul 17, 2021 07:24 AM UTC