在 TeeChart 中使用鼠标滚轮滚动图表 [英] Scroll chart with mouse wheel in TeeChart
本文介绍了在 TeeChart 中使用鼠标滚轮滚动图表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
滚动图表的默认方式是按住鼠标右键拖动鼠标.我需要用鼠标滚轮滚动.我还没有找到任何 API 来启用/禁用鼠标滚轮滚动.
Default way to scroll chart is to drag mouse holding right button. I need to scroll with mouse wheel. I haven't found any API to enable/disable mouse wheel scrolling.
我还尝试将 MouseWheelListener 添加到图表本身,但它从未被调用.
I also tried to add MouseWheelListener to the chart itself, but it never gets called.
是否可以在 TeeChart 库中使用鼠标滚轮?
Is it possible to use mouse wheel in TeeChart lib?
我的应用程序是使用 SWT 的 Eclipse RCP.
My application is Eclipse RCP using SWT.
推荐答案
以下代码对我来说在 Eclipse 中使用 TeeChart Java SWT 很好:
The following code works fine for me with TeeChart Java SWT in Eclipse:
Bar bar1 = new Bar(tChart1.getChart());
bar1.fillSampleValues();
tChart1.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseScrolled(MouseEvent arg0) {
Axis tmpA = tChart1.getAxes().getLeft();
double tmpInc = tmpA.getRange()/10;
if (arg0.count>0)
tmpA.setMinMax(tmpA.getMinimum()+tmpInc, tmpA.getMaximum()+tmpInc);
else
tmpA.setMinMax(tmpA.getMinimum()-tmpInc, tmpA.getMaximum()-tmpInc);
}
});
这篇关于在 TeeChart 中使用鼠标滚轮滚动图表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文