PieChart, PiePlot setBaseSectionPaint doesn't work?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
stepanenkostas87
Posts: 1
Joined: Tue May 30, 2017 9:04 am
antibot: No, of course not.

PieChart, PiePlot setBaseSectionPaint doesn't work?

Post by stepanenkostas87 » Tue May 30, 2017 9:08 am

I have a pie chart. I need fill all section same color. In jfreechart guide, i found method setBaseSectionPaint, but it's didn't work.
I used method setSectionPaint in cycle, but it's not right(excess program code). Why setBaseSectionPaint doesn't work?

Code: Select all

private  JFreeChart createPieChart(PieDataset piedataset){
    JFreeChart jfreechart = ChartFactory.createPieChart("Select the desired dictionary:", piedataset,true, true, false);

    PiePlot pieplot = (PiePlot) jfreechart.getPlot();


    for (int i=0;i<piedataset.getItemCount();i++){  //excess program code
        pieplot.setSectionPaint(piedataset.getKey(i),new Color(54, 95, 196));
    }

    pieplot.setBaseSectionPaint(new Color(54, 95, 196)); //doesn't work
    return jfreechart;
}

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

Re: PieChart, PiePlot setBaseSectionPaint doesn't work?

Post by david.gilbert » Tue May 30, 2017 2:46 pm

David Gilbert
JFreeChart Project Leader

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

Locked