Jump to content
Software FX Community

real-time chart with dates on x-axis

User (Legacy)

Recommended Posts


I'm having trouble creating a real-time chart with DateTime's on the X-axis.

I'm using the RealTime.zip sample program from your download site and trying

to modify it so that every time the Timer goes off, a new point is added to

the chart, with the point's y-value being the random number and x-value

being the current time. Below is the AddPoint() method with my changes.

I'm getting an "Index out of bounds" error when running the program. Am I

missing something? Do you have a sample program that does a similiar thing?



private void AddPoint()


// Switch real-time styles once buffer is full

if (nOffset == BufferSize)


chart1.RealTimeSettings.Style =




//Set Communication Channel styles

//These COD values instruct Chart FX about the Realtime settings

//the chart, values and legend.

SoftwareFX.ChartFX.COD nCOD;

nCOD = SoftwareFX.ChartFX.COD.Values | COD.XValues |


nCOD = nCOD | SoftwareFX.ChartFX.COD.ScrollLegend;

//Add a point for each sereis to the right of the chart

//Using the legend property, set the legend values

System.Random r;

r=new System.Random();

DateTime dt = DateTime.Now;

chart1.OpenData(COD.Values | COD.AddPoints, 1, 1);

chart1.OpenData(COD.XValues | COD.AddPoints, 1, 1);

chart1.Value[0, 0] = -50 + (r.NextDouble() * 100);

chart1.XValue[0, 0] = dt.ToOADate();


nOffset = nOffset + 1;



Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...