4

I am new to JFreechart and I have generated a barchart. The bars have a shining line in it. I want to know if it is possible to get rid of this line in the bars. I want the bars to have a matte effect. I have attached the image of the barchart which I have generated. Any pointers would be of great help.

Thanks in Advance.

enter image description here

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;
}
java_learner
  • 182
  • 3
  • 13
  • For better help sooner, post your code as an [SSCCE](http://www.sscce.org) that demonstrates your problem. This will make it easier for people to post suggested fixes for the matte effect. – Duncan Jones Jul 31 '13 at 09:30
  • +1 for the annotated image; voting to re-open: the answer is the same, but this question is more illustrative. – trashgod Aug 02 '13 at 16:31

1 Answers1

6

The highlight is a feature of GradientBarPainter. Instead, try StandardBarPainter, as suggested here.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045