Single data events hidden on large line charts

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
bfrost
Newbie
Newbie
Posts: 7
Joined: Fri Mar 12, 2004 5:00 am
Location: United Kingdom

Single data events hidden on large line charts

Post by bfrost » Fri Sep 09, 2005 2:23 pm

I've a need to show the user that there is a point on my line series that is very different from the rest, for example 100,000 points may be value=50 but point 1234 may be value=80. When the chart draws, it can hide this single event. How best can I make it visible?
Thanks
Brian

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Sep 09, 2005 2:59 pm

Hi Brian,

You could "play" with pointer styles, colours and with left axis scales as done in the example below. To run it put a TChart into a form and add a line series to it.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
begin
  for i:=1 to 100000 do
    if i=1234 then Series1.Add(80)
    else Series1.Add(50);

  Series1.Pointer.Visible:=true;

  Chart1.Draw;
end;

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var
  Min, Max: double;
begin
  Min:=Series1.YValues.MinValue;
  Max:=Series1.YValues.MaxValue;

  Chart1.Axes.Left.SetMinMax(Min-20,Max+20);
end;

function TForm1.Series1GetPointerStyle(Sender: TChartSeries;
  ValueIndex: Integer): TSeriesPointerStyle;
begin
  if ValueIndex > 0 then
    if (Series1.YValue[ValueIndex]-Series1.YValue[ValueIndex-1]>10) then
      result:=FormatPointer(Sender,ValueIndex)
    else result:=psNothing
  else
    if (Series1.YValue[ValueIndex]-Series1.YValue[ValueIndex+1]>10) then
      result:=FormatPointer(Sender,ValueIndex)
    else result:=psNothing;
end;

function TForm1.FormatPointer(Sender: TChartSeries;
  ValueIndex: Integer): TSeriesPointerStyle;
begin
  (Sender as TLineSeries).Pointer.Color:=clBlue;

  result:=psRectangle;
end;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

bfrost
Newbie
Newbie
Posts: 7
Joined: Fri Mar 12, 2004 5:00 am
Location: United Kingdom

Post by bfrost » Fri Sep 09, 2005 3:38 pm

THanks Narcis. This works but it has also shown that I must be supressing the few high values becuase I notice that your example shows single pixel lines where the values exist, even if I plot 1,000,000 points. I will go and examine my code!
Thanks
Brian

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Sep 12, 2005 8:13 am

Hi Brian,

It appears as a single pixel line because there are many points and just one with that value. However you could also change line pen width.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

bfrost
Newbie
Newbie
Posts: 7
Joined: Fri Mar 12, 2004 5:00 am
Location: United Kingdom

Post by bfrost » Mon Sep 12, 2005 8:35 am

Narcis, Thanks it was me. I had DrawAllPoints set false becuase this was a good speed increase at an earlier time. I think I will have to leave DrawAllPoints set true and live with the increased time. It would be great if DrawAllPoints true looked at the data and rendered the max (or min) of the data points represented by that pixel, that way anyone could still see the data extents and gain the speed advantage.
Brian

bfrost
Newbie
Newbie
Posts: 7
Joined: Fri Mar 12, 2004 5:00 am
Location: United Kingdom

Post by bfrost » Mon Sep 12, 2005 8:36 am

Sorry, I meant "It would be great if DrawAllPoints FALSE looked at the data...."

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Sep 12, 2005 8:58 am

Hi Brian,

Ok, I've added your request to our wish-list to be considered for future releases. However, I guess this feature can also be an inconvenient for other TeeChart users.

If you need to improve your chart's performance please read this article about optimizing TeeChart performance for real-time charting. Maybe you can apply some of those advises to your application.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply