Add DateTimes to x

Originally Posted 9 April 2014, 5:52 am EST

  • Originally Posted 9 April 2014, 5:52 am EST

    Hello I want to do the following:
    I add double values ​​to y and the corresponding datetime to x.

    Now I add this to a Composite Chart

    However, in the X axis is not the correct date displayed here's my example:
    C1CompositeChart1.DataSource = dt;

    int countseries = dt.Columns.Count;
    int width = 0;
    DateTime Anfang = new DateTime(2013, 5, 20, 0, 0, 0);
    DateTime Ende = new DateTime(2013, 5, 21, 0, 0 ,0);

    int i = 1;
    foreach (DataRow dataRow in dt.Rows)
    var series = new CompositeChartSeries();
    if (i == 21)
    i = 20;

    series.Label = dt.Columns[i].ColumnName.ToString();
    series.LegendEntry = true;
    series.Type = ChartSeriesType.Line;

    C1CompositeChart1.Axis.X.AnnoFormatString = "dd/MMM/yyyy hh:mm";
    C1CompositeChart1.Axis.X.AutoMin = true;
    C1CompositeChart1.Axis.X.AutoMax = true;

    Can anyone help me please?

    The date are in a interval 1 minutes to a start date and enddate.
  • Marked as Answer


    Hello TobiasHoeft ,

    Apologies for the delay in response.

    To bind C1CompositeChart, please add C1CompositeChartBinding object to the chart bindings as shown in the code below :
    C1CompositeChart1.DataSource = dt;
    C1CompositeChartBinding bindobj = new C1CompositeChartBinding();
    bindobj.XField = "Date_Time";
    bindobj.XFieldType = ChartDataXFieldType.DateTime;
    bindobj.YField = "Quantity"; // Or any double value column that you want to display
    bindobj.YFieldType = ChartDataYFieldType.Number;


    Let me know if this helps.

Need extra support?

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

Learn More

Forum Channels