This question already has answers here:
JFreeChart BarChart -> NO gradient

(3 个回答)


7年前关闭。




我是 JFreechart 的新手,我生成了一个条形图。酒吧里有一条 Shiny 的线。我想知道是否有可能摆脱酒吧中的这条线。我希望条具有哑光效果。我附上了我生成的条形图的图像。任何指针都会有很大帮助。

提前致谢。

SSCCE:
public JFreeChart createBarChart(CategoryDataset dataset) {
    // TODO Auto-generated method stub
    String unter_title="No of counts";
    JFreeChart jfreechart = ChartFactory.createBarChart(title, unter_title, "frequencies", dataset, PlotOrientation.VERTICAL, true, true, false);
    String text="Test Start Time: "+(new Date(test.getStart_utc_timestamp()).toString()+" "+"Test End Time: "+new Date(test.getEnd_utc_timestamp()));
    jfreechart.addSubtitle(new TextTitle(text, new Font("Dialog", 3, 10)));
    CategoryPlot categoryplot = (CategoryPlot)jfreechart.getPlot();
    categoryplot.setDomainGridlinesVisible(true);
    categoryplot.setRangePannable(true);
    NumberAxis numberaxis = (NumberAxis)categoryplot.getRangeAxis();
    numberaxis.setNumberFormatOverride(NumberFormat.getPercentInstance());
    numberaxis.setUpperMargin(0.10000000000000001D);

    BarRenderer barrenderer = (BarRenderer)categoryplot.getRenderer();
    barrenderer.setDrawBarOutline(false);
    barrenderer.setSeriesPaint(0, Color.DARK_GRAY);

    barrenderer.setMaximumBarWidth(0.0500000000000000001D);
    barrenderer.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("Tooltip: {0}"));
    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    return jfreechart;
}

最佳答案

亮点是 GradientBarPainter 的一个特性。相反,按照建议的 here 尝试 StandardBarPainter

关于java - 对 Jfreechart 生成的条形图的影响,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17965966/

10-12 16:30