-
Notifications
You must be signed in to change notification settings - Fork 845
Data Not Displaying in Correct Order #2275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @moha-b, We have analyzed your query and found that the sorting works correctly when using English month names. However, after replacing them with Arabic month strings, the chart no longer maintains the intended chronological order. To resolve this, we implemented a sorting mechanism by alphabetically sorting the keys of rawSeries1 and rawSeries2. This ensures that the data is displayed in the correct order for chart visualization. We then mapped the sorted keys to the respective data points. For the Arabic version, we translated the English month names using the isArabic flag. This approach ensures that the months are displayed chronologically from January to December, regardless of the language setting. We have shared a code snippet and a sample for your reference. Code Snippet
Output: If you still face the issue, we kindly request you to try to replicate the reported issue in the below attached test sample, so that we can better assist you. Note: In English, the months are sorted alphabetically by their first letter: This leads to the following order: In Arabic, the months are sorted based on their first letter too. Here's the breakdown: This leads to the following order: Regarding multiple series:
If this is not your case, we kindly request you to share with us more information on what you’re proposing as your requirement and usage along with the screenshot and complete sample. Please check and get back to us if you require further assistance. Regards, |
Could you please add the Arabic or English months for sorting?In your code sample, u showed the English months sorted alphabetically, then translated to Arabic. Be aware that the Arabic alphabet is different from the English one, so the Arabic alphabetical sorting is wrong. But this is not our concern, I don't look for alphabetical sorting, I pass to the chart a sorted list, why is it sorting it based on the String? so if I passed to it a list of integars does it sort it from 1 to 100 by default ? |
Bug description
I'm using
SfCartesianChart
in my Flutter app to display monthly sales and cost data. The data is correctly sorted based on the month order before being passed to the chart, but the chart does not display the data correctly.Even though debugging logs confirm that the data is sorted correctly before rendering, the chart does not reflect the correct order in the X-axis.
What I Have Tried:
✅ Sorting Data Properly:
✅ Ensuring Sorted Data is Used:
✅ Disabling Internal Chart Sorting:
✅ Checked State Updates:
✅ Debugging Output Confirms Correct Order:
Output confirms data is in the right order before being passed to the chart, yet the chart still displays incorrect order.
Expected Behavior:
The X-axis should display months in the correct order (Arabic months) after sorting.
Actual Behavior:
The X-axis displays months in random or incorrect order, despite sorting being correct before rendering.
Flutter & Syncfusion Versions:
Flutter:
3.24.5
syncfusion_flutter_charts:
^27.1.53
Dart:
3.5.4
Questions:
Why is the Syncfusion chart ignoring the sorted order of months?
Is there an issue with CategoryAxis forcing its order?
How can I ensure that Arabic month labels appear in the correct order?
Steps to reproduce
sortByMonth
functionCode sample
sectionCode sample
Chart 1
Chart 2
Screenshots or Video
Chart 1
Chart 2
Stack Traces
Stack Traces
i will write the month number for more declaration
month sorting is correct and the data assigned correctly
On which target platforms have you observed this bug?
Android
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: