Hello
i have problem
i would like to show marks but in special conditions.
When chart is in 100% zoom i would like automatically hide marks because there is to much points and showing marks is not useful. So my problem is to check number of showing points in series and if it less than X i would like to set marks to visible. Is there any way to do it?
thanks in advance
Checking count of items in series after zoom
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi guzial,
You can do something like this:
You can do something like this:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(1000);
end;
procedure TForm1.Chart1Zoom(Sender: TObject);
begin
SetMarksVisible(Series1);
end;
procedure TForm1.Chart1UndoZoom(Sender: TObject);
begin
SetMarksVisible(Series1);
end;
procedure TForm1.SetMarksVisible(Series: TChartSeries);
begin
Chart1.Draw;
Series.Marks.Visible:=not (Series.VisibleCount>20);
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 |
Instructions - How to post in this forum |
Hi guzial,
Yes, there seems to be a bug for Gantt series because VisibleCount doesn't seem to return the correct value. I've added it to the wish list to be fixed in further releases (TV52013013). But here you have a workaround that works fine for me here:
Yes, there seems to be a bug for Gantt series because VisibleCount doesn't seem to return the correct value. I've added it to the wish list to be fixed in further releases (TV52013013). But here you have a workaround that works fine for me here:
Code: Select all
procedure TForm1.Chart1Zoom(Sender: TObject);
begin
SetMarksVisible(Series1);
end;
procedure TForm1.Chart1UndoZoom(Sender: TObject);
begin
SetMarksVisible(Series1);
end;
procedure TForm1.SetMarksVisible(Series: TChartSeries);
var i, nInRange: Integer;
begin
Chart1.Draw;
nInRange := 0;
for i:=0 to Series.Count-1 do
begin
if (Series.YValue[i] > Chart1.Axes.Left.Minimum) and (Series.YValue[i] < Chart1.Axes.Left.Maximum) then
nInRange := nInRange+1;
end;
Series.Marks.Visible := not (nInRange > 10);
Series.Marks.Clip := true;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |