Pie Chart and InteriorGap

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
AlanH99
Posts: 18
Joined: Wed Apr 05, 2006 3:31 pm
Location: Edinburgh UK

Pie Chart and InteriorGap

Post by AlanH99 » Wed Jul 11, 2007 3:50 pm

Please see the following example:

http://www.decisionsdecisions.net/examp ... charts.png

I am trying to get the pie to fill the available space in the plot [the plot has the yellow background] however cannot seem to get the chart to expand to the left and right edges.

I have been unable to get this to work with either PieChart or RingChart.

Any ideas?

Thanks.

Code: Select all

    private JFreeChart buildPieChart(Portfolio portfolio)
    {
        PortfolioPieDataset ppd = new PortfolioPieDataset(portfolio);
        
        //JFreeChart chart = ChartFactory.createPieChart("", ppd, false, false, false); 
        //PiePlot plot = (PiePlot)chart.getPlot();
        JFreeChart chart = ChartFactory.createRingChart("", ppd, false, false, false); 
        RingPlot plot = (RingPlot)chart.getPlot();
        
        plot.setLabelGenerator(null);      
        plot.setSectionDepth(0.5);
        plot.setBackgroundPaint(Color.yellow);
        plot.setInteriorGap(0); 
        plot.setOutlinePaint(Color.red);
        //plot.setCircular(true);
        
        return chart;
    }

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Wed Jul 11, 2007 5:01 pm

These settings work for me:

Code: Select all

        plot.setCircular(false);
        plot.setLabelGenerator(null);
        plot.setInteriorGap(0.0);
        plot.setLabelLinkMargin(0.0);
I think the labelLinkMargin should have no effect when there are no labels, so it's probably a bug that you have to set that to zero.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

AlanH99
Posts: 18
Joined: Wed Apr 05, 2006 3:31 pm
Location: Edinburgh UK

Post by AlanH99 » Wed Jul 11, 2007 5:22 pm

Cheers David, I was missing the call to setCircular(false)!

Locked