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
45
Problem with property "TreatDateTimeAsString"
posted

I need a AreaChart which displays the NULL values in a special color.
I use a DataTable as DataSource and everything works fine.
But when i set the property "TreatDateTimeAsString" to FALSE, the Chart will be painted completly different.
Here is my code, and two screenshots of the different display.

Code:

private void button7_Click(object sender, EventArgs e)
        {
            ultraChart1.ChartType = ChartType.AreaChart;
            ultraChart1.Data.EmptyStyle.EnablePE = true;
            ultraChart1.Data.EmptyStyle.EnableLineStyle = true;
            ultraChart1.Data.EmptyStyle.LineStyle.DrawStyle = LineDrawStyle.Dot;
            ultraChart1.Data.EmptyStyle.PE.Fill = Color.Red;


            ultraChart1.AreaChart.NullHandling = NullHandling.InterpolateSimple;
            ultraChart1.AreaChart.TreatDateTimeAsString = false;
            ultraChart1.Data.SwapRowsAndColumns = true;
            ultraChart1.Data.DataSource = GetData();

            ultraChart1.Axis.Y.Labels.ItemFormatString = "<DATA_VALUE:0.#>";
            ultraChart1.Axis.X.Labels.ItemFormatString = "<ITEM_LABEL>";

        }


private DataTable GetData()
        {
            DataTable table = new DataTable();
            DateTime CurrentTime = DateTime.Now;

            table.Columns.Add("Value Column", typeof(double));
            table.Columns.Add("Time Column", typeof(DateTime));

            table.Rows.Add(new object[ { 7.0, CurrentTime });
            table.Rows.Add(new object[ { 4.0, CurrentTime.AddMinutes(5) });
            table.Rows.Add(new object[ { null, CurrentTime.AddMinutes(10) });
            table.Rows.Add(new object[ { 9.0, CurrentTime.AddMinutes(15) });
            table.Rows.Add(new object[ { 5.0, CurrentTime.AddMinutes(20) });
            return table;
        }

Picture when TreatDateTimeAsString = TRUE:

 

Picture when TreatDateTimeAsString = FALSE;

 

Parents
No Data
Reply Children