问题
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?
回答1:
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) {}
});
来源:https://stackoverflow.com/questions/29192514/drawing-line-chart-in-java