TChartSeries.CalcFirstLastVisibleIndex not quite as expected

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Toreba
Newbie
Newbie
Posts: 29
Joined: Wed Sep 02, 2015 12:00 am

TChartSeries.CalcFirstLastVisibleIndex not quite as expected

Post by Toreba » Mon Oct 26, 2015 11:33 am

Hi,

I am using TeeChart Pro 2013.09.131119 32-bit VCL in Delphi XE5.

I have a series of three points plotted against a date-time x-axis. I set the x-axis extents such that the axis minimum has the same x-value as the first point, and the axis maximum has the same x-value as the last point. I run TChart.Refresh, then TChartSeries.CalcFirstLastVisibleIndex.

I then find that TChartSeries.FirstValueIndex = 0 and TChartSeries.LastValueIndex = 0.

And yet two points are visible (and three should be).

What am I doing wrong?

Regards

Toreba

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

Re: TChartSeries.CalcFirstLastVisibleIndex not quite as expected

Post by Yeray » Fri Oct 30, 2015 10:58 am

Hello Toreba,

I've given a try to the code below with the latest version and it seems to work fine for me after forcing a chart repaint with Chart1.Draw:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var Series1: TChartSeries;
    x0, x1: Integer;
begin
  Chart1.View3D:=false;

  Series1:=Chart1.AddSeries(TPointSeries);
  Series1.XValues.DateTime:=true;
  Series1.FillSampleValues(3);

  Chart1.Draw;

  x0:=Series1.FirstValueIndex;
  x1:=Series1.LastValueIndex;

  Caption:='FirstValueIndex: ' + IntToStr(x0) + ', LastValueIndex: ' + IntToStr(x1);
  Chart1.Axes.Bottom.SetMinMax(Series1.XValue[x0], Series1.XValue[x1]);
end;
If you still find problems with it, could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
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