2014-11-04 3 views
2

Я пытаюсь скрыть все ярлыки на моей паук-диаграмме, используя библиотеку JFree.Скрыть ярлыки от диаграммы Spider JFree

Мне повезло, что следующая строка будет работать, но я получаю сообщение об ошибке, когда я его добавляю.

webPlot.setLabelGenerator(null); 

Мой код:

private static JFreeChart createSpiderChart(DefaultCategoryDataset dataset) { 
    SpiderWebPlot webPlot = new SpiderWebPlot(dataset); 

    Font labelFont = new Font("Arial", Font.BOLD, 10); 

    CategoryToolTipGenerator tooltipGenerator = new StandardCategoryToolTipGenerator(); 

    tooltipGenerator.generateToolTip(dataset, 1, 0);  

    Color back_color = new Color(255,255,255,0); 
    webPlot.setOutlineVisible(false); 
    webPlot.setLabelFont(labelFont);  

    webPlot.setSeriesPaint(0, java.awt.Color.decode("#000000")); 
    webPlot.setSeriesPaint(1, java.awt.Color.decode("#209ad4")); 
    webPlot.setBackgroundPaint(back_color); 

    webPlot.setLabelGenerator(null); /** THIS THROWS AN ERROR **/ 

    JFreeChart chart = new JFreeChart("", null /* JFreeChart.DEFAULT_TITLE_FONT */, webPlot, false); 
    chart.setBorderVisible(false); 

    ImageIcon icon = new ImageIcon("C:\\TestCharts\\report-assets\\chart-bg.gif"); 
    chart.setBackgroundImage(icon.getImage()); 

    return chart;  
} 

Моя ошибка:

java.lang.IllegalArgumentException: Null 'generator' argument. 
    at org.jfree.chart.util.ParamChecks.nullNotPermitted(ParamChecks.java:65) 
    at org.jfree.chart.plot.SpiderWebPlot.setLabelGenerator(SpiderWebPlot.java:993) 
    at JavaAgent.createSpiderChart(Unknown Source) 
    at JavaAgent.NotesMain(Unknown Source) 
    at lotus.domino.AgentBase.runNotes(Unknown Source) 
    at lotus.domino.NotesThread.run(Unknown Source) 

Любые идеи и заранее спасибо.

ответ

2

API setLabelGenerator() довольно чистый: null not permitted. Вы можете попробовать использовать различное количество пробелов для columnKey в вашем CategoryDataset.