单击TChart时,在光标下获取系列索引 [英] Get Series Index under cursor when TChart is clicked

查看:244
本文介绍了单击TChart时,在光标下获取系列索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



谢谢。

解决方案

从您点击的活动中,您将获得 X,Y 鼠标位置。

  var 
SeriesIndex:Integer;
begin
SeriesIndex:= Series1.Clicked(X,Y);
if(SeriesIndex -1)then
begin
//使用SeriesIndex
结束;
...
end;

还可以分配一个 OnClickSeries 事件到图表。

 程序TForm1.Chart1ClickSeries(发件人:TCustomChart; 
系列:TChartSeries; ValueIndex:Integer;按钮:TMouseButton;
Shift:TShiftState; X,Y:Integer);


How can I get series index from cursor position when I click TChart?

Thank you.

解决方案

From your clicked event, you will get the X,Y mouse position.

var
  SeriesIndex: Integer;
begin
  SeriesIndex := Series1.Clicked(X,Y);
  if (SeriesIndex <> -1) then
  begin
    // Do something with SeriesIndex
  end;
  ...
end;

It is also possible to assign an OnClickSeries event to the chart.

procedure TForm1.Chart1ClickSeries(Sender: TCustomChart;
  Series: TChartSeries; ValueIndex: Integer; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);

这篇关于单击TChart时,在光标下获取系列索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆