Page 1 of 1
Increase 'OnClickAxis' activation area?
Posted: Wed Jun 01, 2005 9:19 pm
by 9339576
Is there a way to increase the area which will activate the 'OnClickAxis' function? I would have thought that simply clicking the numbers would work but you have to click within the tick size range.
- Dave A. Law
NuFlo Measurement Systems
Posted: Thu Jun 02, 2005 9:23 am
by narcis
Hi Dave,
I'm afraid not. However you may implement it using MouseDown event and checking if the clicked point (X,Y coordinates provided by the event) is within a rectangle you may define from axis
IStartPos,
IEndPos and
PosAxis. This could be something like:
Code: Select all
procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
Top,Bottom,Left,Right: Integer;
begin
Top:=Chart1.LeftAxis.IStartPos;
Bottom:=Chart1.LeftAxis.IEndPos;
Left:=Chart1.LeftAxis.PosAxis-30;
Right:=Chart1.LeftAxis.PosAxis;
if ((X>=Left) and (X<=Right) and (Y>=Top) and (Y<=Bottom)) then
Chart1.Title.Text[0]:='Left Axis Clicked!'
else Chart1.Title.Text[0]:= '';
end;
Please notice that this code works for a vertical axis. If you want to do it for an horizontal one you'll have to assigne IStartPos and IEndPost to Left and Right values respectively and use PosAxis for Top and Bottom values.
Posted: Fri Jun 10, 2005 8:52 am
by 9039038
Narcis:
Along these lines, is there a way of allowing the user to click on an axis caption and have an easily-identifiable event for the program to use to respond to the click?
What I am thinking of is a simple 2-D chart with the X axis labeled as months, and when the user clickes on, say, the "Feb 2005" label, the program can display information relating to that time period (not extracted from the chart, just responding for that general x-location on the chart.
In other words, the TeeChart program allows the user to do wonderful things at runtime, and because of that the locations of points on the axes can shift on the screen. What I want is to be able to identify a (shifted) location within the displayed data where the user clicks and respond to that. I don't need to get XY coordinates for data points clicked on, just which axis label is closest. It would be nice if each label was in an invisible box and if I clicked in the box I could read out the label as a string.
This would be worth upgrading from Std to Pro for me.
Thanks for reading this and thinking about it.
-- Jim Gold --
jim@goha.com