我创建了一个应用程序,该应用程序根据使用JFreeChart从输入文件读取的输入创建条形图,现在我希望当我将鼠标指向特定条形时,它会显示负责该条形的输入。这该怎么做 ?
我打印条形图的代码-
public BarChart(double val[],String title) {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
for(int i=1;i<=val.length;i++){
dataset.setValue(val[i-1], "Execution Time(ms)",""+i);
}
JFreeChart chart = ChartFactory.createBarChart
("BarChart for "+title,"API calls", "Execution Time(ms)", dataset,
PlotOrientation.VERTICAL, false,true, false);
CategoryPlot p = chart.getCategoryPlot();
p.setRangeGridlinePaint(Color.red);
frame1=new ChartFrame("Bar Chart",chart);
final Rectangle s = WindowBound.getMaximumWindowBounds();
final Dimension f = frame1.getSize();
final int w = Math.max(s.width - f.width, 0);
final int h = Math.max(s.height - f.height, 0);
final int x = (int) (0.5 * w) + s.x;
final int y = (int) (0.5 * h) + s.y;
frame1.setBounds(x-300, y-300, f.width, f.height);
frame1.setIconImage(Toolkit.getDefaultToolkit().getImage("Images/Icon.jpg"));
frame1.setSize(600,600);
}