滚动图表的默认方式是拖动鼠标并按住鼠标右键。我需要用鼠标滚轮滚动。我尚未找到任何启用/禁用鼠标滚轮滚动的API。
我还尝试将MouseWheelListener添加到图表本身,但从未调用过它。
是否可以在TeeChart lib中使用鼠标滚轮?
我的应用程序是使用SWT的Eclipse RCP。
以下代码对我在Eclipse中使用TeeChart Java SWT的工作正常:
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);
}
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句