Hiding data points

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Sharpenski
Newbie
Newbie
Posts: 36
Joined: Wed Aug 24, 2016 12:00 am

Hiding data points

Post by Sharpenski » Tue Sep 06, 2016 9:07 am

Hi,

I've created a function in Delphi which highlights data points as the mouse moves across the chart - it does this by increasing the size of the point as the mouse moves over it and then shrinking it again once the mouse moves away. I would like to update this so that each point is completely invisible until the mouse moves near it - is there a way of making each point invisible on an individual basis?

Regards,

Toby

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Hiding data points

Post by Yeray » Tue Sep 06, 2016 10:50 am

Hello,

You can use Null Points feature: you can set all the points of the series to be null (note you may need to manually set your axis range in order to show the are where the hidden points are) and use the OnMouseMove event to change the "Null" status of the point below the mouse, if any. Ie:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1.View3D:=false;
  Chart1.Hover.Visible:=false;

  with Chart1.AddSeries(TPointSeries) do
  begin
    FillSampleValues();

    for i := 0 to Count-1 do
      SetNull(i);
  end;

  visibleIndex:=-1;

  Chart1.Axes.Left.SetMinMax(Chart1[0].YValues.MinValue - 10, Chart1[0].YValues.MaxValue + 10);
end;

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var tmp: Integer;
begin
  if visibleIndex>-1 then
    Chart1[0].SetNull(visibleIndex);

  visibleIndex:=Chart1[0].Clicked(X,Y);

  if visibleIndex>-1 then
    Chart1[0].SetNull(visibleIndex, False);
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply