用Java绘制折线图 [英] Drawing Line chart in Java
本文介绍了用Java绘制折线图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在每个点都有一个按钮的位置绘制一个图形.当我单击按钮时,它将执行某些操作.这是一个链接;我希望我的图看起来像这样.有人可以建议我怎么做吗?
I want to draw a graph on each point of which there will be a button. When I will click the button, it will do something. Here's a link; I want my graph to look like this. Can anybody suggest me how to do it?
推荐答案
使用 JFreeChart
,添加ChartPanel
,如此处所述.在chartMouseClicked()
的实现中,请调用Desktop#browse()
,如图此处所示.在轮廓上,
Using JFreeChart
, add a ChartMouseListener
to your ChartPanel
, as outlined here. In your implementation of chartMouseClicked()
invoke Desktop#browse()
, as illustrated here. In outline,
chartPanel.addChartMouseListener(new ChartMouseListener() {
public void chartMouseClicked(ChartMouseEvent e) {
// construct a URI based the result from e.getEntity()
desktop.browse(uri);
}
public void chartMouseMoved(ChartMouseEvent e) {}
});
这篇关于用Java绘制折线图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文