# set the background color for the chart...
chart.setBackgroundPaint(Color.WHITE)

plot = chart.getPlot()
plot.setBackgroundPaint(Color.WHITE)
plot.setRangeGridlinesVisible(False)
plot.setAxisOffset(RectangleInsets.ZERO_INSETS)

#customise the range axis...
rangeAxis = plot.getRangeAxis()
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits())
rangeAxis.setAutoRangeIncludesZero(True)
#Set the Min Max value of the y axis
rangeAxis.setRange(0, 100)
#Create a custom BarRenderer
barRenderer = BarRenderer()
#Add a label in the middle of the histogram bar showing the % value
barRenderer.setBaseItemLabelGenerator(StandardCategoryItemLabelGenerator())
barRenderer.setBaseItemLabelsVisible(True)
#For parameters
#See http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/labels/ItemLabelAnchor.html
#See http://www.jfree.org/jcommon/api/org/jfree/ui/TextAnchor.html and 
itemlabelposition = ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER, TextAnchor.BOTTOM_CENTER, 0.00)
barRenderer.setBasePositiveItemLabelPosition(itemlabelposition)
#Customize the bar's color so they will be gray with a black outline and no shadow
barRenderer.setBarPainter(StandardBarPainter())#Use StandardBarPainter to avoid the color gradient inside the bar
barRenderer.setSeriesOutlinePaint(0, Color.BLACK)
barRenderer.setSeriesPaint(0, Color.GRAY)
barRenderer.setItemMargin(0.0)
barRenderer.setShadowVisible(False)
#Apply the renderer for the plot
Exemple #2
0
 def __init__(self, state, dataset):
     BarRenderer.__init__(self)
     self.state = state
     self.dataset = dataset
Exemple #3
0
 def __init__(self, state, dataset):
     BarRenderer.__init__(self)
     self.state=state
     self.dataset=dataset