线未显示在Netbeans IDE中的线图上

线未显示在Netbeans IDE中的线图上,netbeans,graph,Netbeans,Graph,我创建的JFreeChart是一个折线图。我遇到的问题是图表上的线没有显示出来 谁能告诉我为什么会发生这种事 以下是按钮的编码: DefaultCategoryDataset dataset2 = new DefaultCategoryDataset(); dataset2.setValue(100, "John B","EMP0001"); dataset2.setValue(200, "John A","EMP0003"); JFreeCha

我创建的JFreeChart是一个折线图。我遇到的问题是图表上的线没有显示出来

谁能告诉我为什么会发生这种事

以下是按钮的编码:

DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
        dataset2.setValue(100, "John B","EMP0001");
        dataset2.setValue(200, "John A","EMP0003");

        JFreeChart chart2 = ChartFactory.createLineChart("Comission", "Employee", "Number of Sales", dataset2, PlotOrientation.VERTICAL, false, true, true);
        chart2.setBackgroundPaint(Color.YELLOW);
        chart2.getTitle().setPaint(Color.RED);
        CategoryPlot p2 = chart2.getCategoryPlot();
        p2.setRangeGridlinePaint(Color.BLUE);
        ChartFrame frame2 = new ChartFrame("Employee Comission", chart2);
        frame2.setVisible(true);
        frame2.setSize(450,350);
创建折线图时会发生以下情况:


请有人帮我指出可能的问题所在。

为了显示一行,您需要有两个数据项,它们的行键值相同,列键值不同

如果将数据更改为:

dataset2.setValue(100, "John A","EMP0000");
dataset2.setValue(200, "John A","EMP0001");
dataset2.setValue(300, "John B","EMP0002");
dataset2.setValue(400, "John B","EMP0004");
然后在图中:

请注意,“John A”值为红色,“John B”值为蓝色和蓝色 红色和蓝色没有连接。列值沿底部打印