Page 1 of 1
Remove shadow offset on Bar Charts?
Posted: Sun Nov 14, 2010 12:02 pm
by ptd26
2 issues:
1. How do I get rid of the offset from 0? The blue bars should be touching the green bars at 0 on the x-axis (not shown).
2. How do I either get rid of the 3d or make the 3D bars render horizontally instead of vertically as shown above -- the bars above are horizontal, but the texture / shadow / 3D shape is rendering vertically (looks like bar is standing up instead of on it's side).
Re: Remove shadow offset on Bar Charts?
Posted: Sun Nov 14, 2010 3:28 pm
by skunk
2. Call the following before creating any chart objects
Code: Select all
XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter() {
@Override
public void paintBarShadow(Graphics2D g2, XYBarRenderer renderer, int row,
int column, RectangularShape bar, RectangleEdge base,
boolean pegShadow) {}
});
Modify as required if you are using Category* instead of XY*
Re: Remove shadow offset on Bar Charts?
Posted: Mon Nov 15, 2010 12:09 am
by ptd26
That didn't seem to fix it. I think the problem might not be the shadow. If you look at the bars carefully, they appear to be drawn vertically instead of horizontally. I think the gap between the 0 on the x-axis the the bottom of each bar might be the margin. I'm using a CombinedXYRangeChart and above is one of the subplots shown.
Each subplot is very simply constructed following one of the demo examples:
intervaldataset = new XYIntervalSeriesCollection();
XYBarRenderer renderer1 = new XYBarRenderer(0.20);
renderer1.setUseYInterval(true);
XYPlot subplot1 = new XYPlot(intervaldataset, new NumberAxis("Size"), null, renderer1);
The subplot is then added to the main plot:
plot.add(subplot1);
Main Plot is constructed like this:
JFreeChart jfchart = new JFreeChart("Combined (Range) XY Plot", JFreeChart.DEFAULT_TITLE_FONT, plot, false);
NumberAxis vaxis = (NumberAxis)plot.getRangeAxis();
plot.getRangeAxis().setAutoRange(true);
add(new ChartPanel(jfchart));