Hello,
i've a problem with the TeeChartScrollBar. I've got a simple dataset with two fields: X (TDateTime) and Y (Integer). The minimum of X is today, the maximum is 100 days from today. I've connected a TeeChartScrollbar to the chart with the following properties: Axis = sbDefault; Align = alBottom; Kind = sbHorizontal. When I run the application everything looks good, but when i zoom in on the chart the values on the X-axis change to dates around 1900. The same things happened when I changed the X-axis from TDateTime to integer values, but it only occurs with large numbers (>30000).
I've tried to track the problem and it seems that the ScrollAxis(Axis:TChartAxis) inline procedure sets uncorrect values for my X-axis.
Can you explain how I can fix this problem? Im using TeeChart Pro 7.12. If necessary I can provide you with an example which you can run "as is".
Greetings,
Marcel.
TeeChartScrollbar: problem with zoom in
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Marcel,
This is because TChartScrollBar is not using DateTime range. You could try setting its maximum to 50000 at designtime and then use this code:
Hope this helps!
This is because TChartScrollBar is not using DateTime range. You could try setting its maximum to 50000 at designtime and then use this code:
Code: Select all
uses DateUtils, Math;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var i: integer;
begin
Series1.XValues.DateTime:=true;
for i:=0 to 100 do
begin
Series1.AddXY(Today + i, random);
end;
ChartScrollBar1.Min := Trunc(Series1.MinXValue);
ChartScrollBar1.Max := Trunc(Series1.MaxXValue);
Chart1.Title.Text[0]:=IntToStr(ChartScrollBar1.Max);
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 Narcis,narcis wrote:Hi Marcel,
This is because TChartScrollBar is not using DateTime range. You could try setting its maximum to 50000 at designtime and then use this code:
Hope this helps!Code: Select all
uses DateUtils, Math; {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); var i: integer; begin Series1.XValues.DateTime:=true; for i:=0 to 100 do begin Series1.AddXY(Today + i, random); end; ChartScrollBar1.Min := Trunc(Series1.MinXValue); ChartScrollBar1.Max := Trunc(Series1.MaxXValue); Chart1.Title.Text[0]:=IntToStr(ChartScrollBar1.Max); end;
thanks for the quick response. Your suggestion works to a certain extent in my sample application. However it can't get it to right in my main application. Ill try to see if there's a difference between the two.
Thanks,
Marcel.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Marcel,
Your problem seems the same as described here. For now, the solution is using TScrollBar instead of TChartScrollBar. I have sent you an e-mail with and example using TScrollBar.
Your problem seems the same as described here. For now, the solution is using TScrollBar instead of TChartScrollBar. I have sent you an e-mail with and example using TScrollBar.
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 |