如何在chart上显示鼠标处的曲线坐标?
我做了一个图表想鼠标放到曲线上就能显示该点坐标
要怎么做呢
我做了一个图表想鼠标放到曲线上就能显示该点坐标
要怎么做呢
解决方案 »
- 请问一下,如果使用indy10.2.3的Tidmappedporttcp来开发端口映射工具,性能如何?
- 哪位有能半透明显示PNG图片的代码啊~~我想要啊~~~
- 文字问题!!如何使"pppp1111"变为"1111qqqq"
- form上有两个button,按A button 相当于按B button
- 很菜的问题,不过我刚学相信大家会帮我的。
- 华表应用
- 送分了,会者不难。请问以下句子有什么地方不对?
- delpi調用BPL方式求幫助
- 在d6中使用 if table1['ss']<>null then 怎么报错undeclared identifier 'null
- 我怎么才能让clientsocket的onconnect事件自动执行?急!急!急!
- 【再转贴一文】电子邮件头全揭密:)
- ★★★★★帮忙起个名字200分送上★★★★★
TShiftState Shift, int X, int Y)
{
int tmpX, intY;
POINT pXY;
pXY.x=X-Chart1->Width3D;
pXY.y=Y+Chart1->Height3D;
if (PtInRect(&(Chart1->ChartRect), pXY))
{
Chart1->Series[0]->GetCursorValues(tmpX,tmpY);
}
}
begin
LineSeries1.FillSampleValues(30); { <-- some random values }
OldX:=-1; { initialize variables }
CrossHairColor:=clYellow;
CrossHairStyle:=psSolid;
end;procedure Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer); { This procedure draws the crosshair lines }
Procedure DrawCross(AX,AY:Integer);
begin
With Chart1,Canvas do
begin
Pen.Color:=CrossHairColor;
Pen.Style:=CrossHairStyle;
Pen.Mode:=pmXor;
Pen.Width:=1;
MoveTo(ax,ChartRect.Top-Height3D);
LineTo(ax,ChartRect.Bottom-Height3D);
MoveTo(ChartRect.Left+Width3D,ay);
LineTo(ChartRect.Right+Width3D,ay);
end;
end;Var tmpX,tmpY:Double;
begin
if (OldX<>-1) then
begin
DrawCross(OldX,OldY); { draw old crosshair }
OldX:=-1;
end; { check if mouse is inside Chart rectangle }
if PtInRect( Chart1.ChartRect, Point(X-Chart1.Width3D,Y+Chart1.Height3D) ) then
begin
DrawCross(x,y); { draw crosshair at current position }
{ store old position }
OldX:=x;
OldY:=y;
{ set label text }
With LineSeries1 do
begin
GetCursorValues(tmpX,tmpY); { <-- get values under mouse cursor }
Label1.Caption:=GetVertAxis.LabelValue(tmpY)+
' '+
GetHorizAxis.LabelValue(tmpX);
end;
end;
end;procedure chart1AfterDrawValues(Sender: TObject);
begin
OldX:=-1; { Reset old mouse position }
end;
////////////////////////////
LineSeries1: TLineSeries;
Y值:(round(chart1.Series[0].YScreenToValue(y)*1000)/1000)