Barchart removes duplicates

So I have a bar chart and the data I am passing in is the first letter of each month along with some data so something like this:

List getChartData() {
final List chartData = [
Data('J', 12.0),
Data('F', 15.6),
Data('M', 17.5),
Data('A', 14.7),
Data('M', 12.4),
Data('J', 15.9),
Data('J', 12.3),
Data('A', 14.5),
Data('S', 12.8),
Data('O', 13.4),
Data('N', 13.2),
Data('D', 11.9),
];
return chartData;
}

But when I pass the data into the column series, it removes duplicates so I will only see 1 J on the bar chart when I should be seeing 3 (Jan, July, June).


How can I have duplicates in this barchart (all the months)?


Thanks, Please let me know if I am unclear on anything.


3 Replies 1 reply marked as answer

YG Yuvaraj Gajaraj Syncfusion Team June 29, 2022 02:28 PM UTC

Hi Alvin,


Greetings from Syncfusion. We would link to let you know that the bar series with the same x value did not get removed, it is just appended one on another. We suggest you use the arrangeByIndex property in the category axis it will help you to render a bar chart based on the index. We have attached the code snippet below to achieve your requirement.


Code snippet:

SfCartesianChart(

  primaryXAxis: CategoryAxis(

    arrangeByIndex: true,

  ),

  // Other required properties

)


If you have any other queries, please get back us.


Regards,

Yuvaraj.


Marked as answer

AL Alvin Lam replied to Yuvaraj Gajaraj June 29, 2022 02:56 PM UTC

Oh ok, I see how it works now. Thanks for your help!



YG Yuvaraj Gajaraj Syncfusion Team June 30, 2022 11:15 AM UTC

Hi Alvin,


Thanks for the update. We are always happy to assist you. If you have any further queries, please get back to us.


Regards,

Yuvaraj.


Loader.
Up arrow icon