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
Hiding data points
Re: Hiding data points
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:
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,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |