0
votes

In a FastLine Series I want to display a line that represents a percent level at different times. The y-axis is % and the x-axis is DateTime.

I update the line in an asynchronous event where I add the new data point to the series including the according timestamp and the color, like below.

fastLine.Add(timestamp, yValue, color);

The TeeChart is set up like this:

In xaml:

<DockPanel x:Name="dpMain">
    <WPF:TChart x:Name="tChart" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
</DockPanel>

In code-behind:

  this.tChart.HorizontalAlignment = HorizontalAlignment.Stretch;
  this.tChart.VerticalAlignment = VerticalAlignment.Stretch;
  this.tChart.Aspect.View3D = false;
  this.tChart.Legend.Visible = false;
  this.tChart.Zoom.Allow = false;

  //create at least one fast line series.
  this.fastLine = new FastLine(this.tChart.Chart);
  this.tChart.Series.Add(this.fastLine);

  this.tChart.Axes.Left.Automatic = false;
  this.tChart.Axes.Left.Maximum = 100;
  this.tChart.Axes.Left.Minimum = 0;

  //this.tChart.Axes.Bottom.Automatic = false;
  this.tChart.Axes.Bottom.Labels.DateTimeFormat = "dd/MM/yy \n HH:mm:ss";
  this.tChart.Axes.Bottom.Labels.Angle = 90;

  fastLine.Marks.Visible = false;
  fastLine.XValues.DateTime = true;

The update events are triggered every 10 seconds, but this timespan may change.

My problem is that as soon as the second event arrives, the chart is filled with a lot of data points resulting in a horizontal line being displayed and the bottom axis is filled with a lot of date entries. Moreover, it seems as if the color I provide in the "Add" function is ignored.

How can I have the FastLine display only the point that are added in the async event?

Is there an easy way to achieve a "windowing" effect? I want the newest points to be visible all the time (like scrolling to the right).

Regards,

tabina

1

1 Answers

0
votes

My problem is that as soon as the second event arrives, the chart is filled with a lot of data points resulting in a horizontal line being displayed and the bottom axis is filled with a lot of date entries.

Can you please send a simple example project we can run "as-is" to reproduce the problem here? You can post your files at http://www.steema.net/upload/ or send them to info at steema dot com referencing this question.

Moreover, it seems as if the color I provide in the "Add" function is ignored.

FastLine series doesn't support different colors for each point in the series. FastLine series was designed for performance purposes and some functionality was stripped of to achieve that. To get line segments with different colors you should use Line series instead and use its ColorEach property.

How can I have the FastLine display only the point that are added in the async event?

We would need to see a project reproducing the problem to be able to see which is the exact problem and provide an accurate reply.

Is there an easy way to achieve a "windowing" effect? I want the newest points to be visible all the time (like scrolling to the right).

Sure, there's an example of this at All Features\Welcome !\Speed\Realtime charting in the features demo included with TeeChart's installation.