How to bind DataTable to Flexchart

Posted by: malishin on 10 December 2019, 9:23 pm EST

    • Post Options:
    • Link

    Posted 10 December 2019, 9:23 pm EST

    I want to bind a datatable to flexchart,But the series is not shown in the chart.

    FlexChartDemo.zip

  • Posted 11 December 2019, 4:11 pm EST

    Hi,

    I am sorry but I could not observe any issue in displaying series while using DataTable as DataSource for the chart/series. Please refer to the attached modified sample for the same and let me know if something else is to be done?

    Also, the sample you provided was WinForms sample(whereas query is created in WPF Edition forum) so, I am assuming that you need help for WinForms FlexChart only.

    Regards,

    Basant

    FlexChartDemo_Mod.zip

  • Posted 11 December 2019, 4:43 pm EST

    Hi Basant,

    Sorry I provided the wrong code, I cannot bind datatable on WPF,

    I used the same background code as Winform for binding, but couldn’t display the series

  • Posted 11 December 2019, 4:59 pm EST

    In fact, I have another question about the provided Winforms demo.

    How do I change the order of the Y axis or the legend of the two series ? My purpose is to make the order of the Y axis is same as the legend order.

    Keep the blue legend to the left of the red

  • Posted 11 December 2019, 5:00 pm EST

    Hi,

    In the case of WPF FlexChart, you need to provide DataView of the required DataTable to the ItemsSource of the chart/series.

    ser1.ItemsSource = dataAAA.AsDataView();
    ser2.ItemsSource = dataBBB.AsDataView();
    
    

    Regards,

    Basant

  • Posted 11 December 2019, 5:26 pm EST

    In order to change(reverse in your case) the order of legends, you can simply set Legend.Reversed property to true.

    flexChart1.Legend.Reversed = true;
    
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels