Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
285
How to get line chart with date value on x axix and other values on Y?
posted

I have a dataset having table with 3 columns. Records in the table holds multiple values for group of data.

I need to plot the data in line chart such that values from date would be plotted on X and other two columns would be on Y.

Sample data and chart is attached in zip file.

Can you please let me know how to achieve this? IG Samples for charts does not have anything that would resemble to what I am looking for. I may have to go with custom chart, but I cannot figure out how to use it.

code snippet or sample would be a great help

IGChartSample.zip
Parents
No Data
Reply
  • 17605
    posted

    Try using this code:

            this.UltraChart1.ChartType = ChartType.LineChart;

     

            DataTable table = new DataTable();

     

            table.Columns.Add("a", typeof(DateTime));

            table.Columns.Add("b", typeof(double));

            table.Columns.Add("c", typeof(double));

     

            table.Rows.Add(DateTime.Now, 10, 30);

            table.Rows.Add(DateTime.Now.AddDays(1), 10, 0);

            table.Rows.Add(DateTime.Now.AddDays(2), 20, 50);

            table.Rows.Add(DateTime.Now.AddDays(3), 60, 20);

            table.Rows.Add(DateTime.Now.AddDays(4), 10, 10);

     

            this.UltraChart1.Data.SwapRowsAndColumns = true;

            this.UltraChart1.DataSource = table;

            this.UltraChart1.DataBind();

Children
No Data