I'm having a problem returning the X axis label.
I load up the candle chart thus.
With Series1 do
begin
For X := 1 To NumRecs do
begin
AddCandle( X,
Stock_Data[X].Open,
Stock_Data[X].High,
Stock_Data[X].Low,
Stock_Data[X].CloseP);
DecodeDate(Stock_Data[X].Date, tmpYear, tmpMonth, tmpDay );
Labels[X]:= FormatFloat('0000',tmpYear)+
FormatFloat('00',tmpMonth)+
FormatFloat('00',tmpDay);
end;
end;
It is a scrolling chart with over 3000 records.
While moving the mouse over the Series, I need to return the label for the mouse X position.
Thanks in advance.
Returning the X axis label when moving mouse
Hi Phineas,
Could you take a look at this post? I think it's pretty similar than what you are looking for.
Could you take a look at this post? I think it's pretty similar than what you are looking for.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Yeray, the code you suggest will only function while the mouse is over the actual series. I require the X value as a date returned while the mouse is moving anywhere over the entire chart.
I managed it thus.
ValueIndex := Round(Series1.XScreenToValue(X));
Edit1.Text := Series1.Labels[ValueIndex];
I am not happy with having the ROUND statement. This can have the effect of not being accurate some of the time. Is there a better way?
Thanx.
I managed it thus.
ValueIndex := Round(Series1.XScreenToValue(X));
Edit1.Text := Series1.Labels[ValueIndex];
I am not happy with having the ROUND statement. This can have the effect of not being accurate some of the time. Is there a better way?
Thanx.
Hi Phineas,
Excuse me. I think I didn't understand well your request. To retrieve the corresponding value in bottom axis for an x point, you could do as follows:
Then if you want to get the corresponding series' value index, you should use a round or a trunc function.
Excuse me. I think I didn't understand well your request. To retrieve the corresponding value in bottom axis for an x point, you could do as follows:
Code: Select all
procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
caption := floattostr(Chart1.Axes.Bottom.CalcPosPoint(X));
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |