Hi all
I want to create a simple time-scaled linechart.
Therefore I have a row-based DataTable, first column is called "Timestamp" and has the type DateTime.
The other columns are numeric of type int and can be NULL.
That's how I bind the data:
===============================================
protected void Page_Load(object sender, EventArgs e)
{
this.chartCtrl.LineChart.TreatDateTimeAsString = false;
this.chartCtrl.Data.SwapRowsAndColumns = true;
this.chartCtrl.Axis.X.Labels.ItemFormatString = "<ITEM_LABEL:dd-hh>";
this.chartCtrl.Axis.X.TimeAxisStyle.TimeAxisStyle = Infragistics.UltraChart.Shared.Styles.RulerGenre.Discrete;
this.chartCtrl.LineChart.NullHandling = Infragistics.UltraChart.Shared.Styles.NullHandling.InterpolateSimple;
this.chartCtrl.DataSource = CreateTimebasedDataSource();
this.chartCtrl.DataBind();
}
private DataTable CreateTimebasedDataSource()
{
DataTable mydata = new DataTable();
Random rnd = new Random();
DateTime stepTime = DateTime.Now;
mydata.Columns.Add( "Timestamp", typeof( DateTime ) );
mydata.Columns.Add( "Series 1", typeof( int ) );
for ( int i = 0; i < 10; ++i )
{
// randomly set timestamp intervall
stepTime = stepTime.AddHours( 1 + rnd.Next( 5 ) );
// randomly create a real numeric value or a NULL - entry
object val1 = ( i % 2 == 0 ) ? ( object ) rnd.Next( 100 ) : null;
mydata.Rows.Add( new Object[ { stepTime, val1 } );
}
return mydata;
}
==================================================
Everything works fine as long as I don't have NULL values in the numeric columns, but as soon as I have a numeric value, just the labels on the X-Axis are displayed but not the according curve.
Can please somebody help me ?
Thanks in advance & greetings
Bernd