Hi
I have used your library to create line chart, but in the example all the series are created statically.
I want to create series dynamically.
I tried something in my code but cant work it.
series:<ChartSeries>[getChart()]);}getChart() {for (var item in spesificConsumptionData) {return// Initialize line seriesSplineSeries<_SpesificConsumptionData, String>(animationDuration: 1,dataSource: item,name: spesificConsumptionDataLegendTitle,xValueMapper: (_SpesificConsumptionData data, _) => data.x,yValueMapper: (_SpesificConsumptionData data, _) => data.y,);}}
Can you help me with that?
Thanks
Hi Yuvaraj,
This is exactly what i wanted. Thank you support team and you.
Hi Yuvaraj,
I integrated this function in my code and it works dynamically but its rendering incorrect as follows
if you choose 1 series there is no problem.
Did you encounter this problem?
This series all x values sometimes different sometimes same Would you think is this a problem?
|
LineSeries(
//Other required properties
sortingOrder: SortingOrder.ascending,
sortFieldValueMapper: (ChartData data, _) => data.x,
) |
Hi Yuvaraj,
I tried solution your mentioned in my project but i have still getting same problem. Even if only 1 data different then others, the different data appear at the end of the chart. Then chart gets mixing.
Hi Mehmet,
As stated in our previous update, we have sorted the x values in ascending order with the help of sortingOrder and sortFieldValueMapper properties all were working fine. We have attached the sample below which is used in the testing phase. Since we are not aware of your exact data source, kindly change and get back to us by modifying the attached sample, this will be useful to provide you with the solution sooner.
Sample: https://www.syncfusion.com/downloads/support/forum/173253/ze/dynamic_update-34137554
Regards,
Maris.
Hi Marismathan,
I guess I couldn't explain the problem, sortingOrder and sortFieldValueMapper were working fine for me too.
If there is a data that does not match the dates and times in the 3 series, this data is thrown to the end of the graph.
Like this => https://prnt.sc/H5_yVMiqPdaz
Also, if I create this graph without being dynamic, there is no problem.
I hope I was able to explain.
Hi Mehmet,
We have analyzed the query with the data point which does not match the 3 series in the chart, we have given the data points(x-values) to the chart as per the data in your screenshot, but the series were rendering properly,
Since we could not replicate your scenario at our end, we request you to modify the attached sample with your data source and replicate your scenario in that, so that we can analyze and provide you with a prompt solution.
Screenshot:
Regards,
Yuvaraj.
Hi Shamini,
I added my problematic dataset in main as an example on your dynamic_update.rar.
Thanks, good work.
Hi Mehmet,
We have analyzed the attached document and suggest you use the arrangeByIndex property in the CategoryAxis it will help you to arrange the data point based on the index. We have attached the code snippet and demo sample link below for your reference.
Code snippet:
|
primaryXAxis: CategoryAxis( arrangeByIndex: true, ), |
UG: https://help.syncfusion.com/flutter/cartesian-charts/axis-types#indexed-category-axis
Demo sample: https://flutter.syncfusion.com/#/cartesian-charts/axis-types/category/arranged-by-index
Regards,
Yuvaraj.
Hi Yuvaraj,
That's property solved my problem. Thanks for your time.
Good works.
Hi Mehmet,
Thanks for the update. We are always happy to assist you, if you have any further queries, please get back to us.
Regards,
Yuvaraj.