Tooltip with values while using SpiderWebPlot

你。 提交于 2019-12-01 18:54:34

ChartPanel "registers with the chart to receive notification of changes to any component of the chart." I suspect you have neglected to construct a ChartPanel; given a static version of prepareChart(), the following main() works for me. See also Initial Threads.

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {

        @Override
        public void run() {
            JFrame f = new JFrame("Spider Web Plot");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(new ChartPanel(prepareChart()));
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
        }
    });
}

Addendum: Based on the posted screenshots, you'll need a custom CategoryItemLabelGenerator, which can be set using setLabelGenerator(). It will be called from drawLabel(), shown here. For example,

plot.setLabelGenerator(new StandardCategoryItemLabelGenerator() {

    @Override
    public String generateColumnLabel(CategoryDataset dataset, int col) {
        return dataset.getColumnKey(col) + " " + dataset.getValue(0, col);
    }
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!