Jump to content
JChartFX Community
  • 0
xilton

Change default Pie colors

Question

 This may seem dumb but I just can't get my pie colors changed. I'm able to with bar graphs but not simple 2d pies? I know I'm doing something wrong but what. Works fine for bars. Thanks

 

Javascript code

...

    chart1.setGallery(cfx.Gallery.Pie);
    chart1.getAllSeries().getPointLabels().setVisible(true);
    chart1.getAllSeries().getPointLabels().setFormat("%v");
    chart1.getLegendBox().setVisible(true);   
    chart1.getLegendBox().setDock(cfx.DockArea.Bottom);

    chart1.getSeries().getItem(0).setColor("#FF9900");  

    chart1.getSeries().getItem(1).setColor("#009900");    


    var pie = chart1.getGalleryAttributes();
    pie.setExplodingMode(cfx.ExplodingMode.All);   

...

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

 ok I got it to work like follows

chart1.getPoints().getItem(0,3).setColor("#FFAA34");

 

now I only need to fix the legend to show the same color

Share this post


Link to post
Share on other sites
  • 0

Instead of using getItem(0,3), use getItem(-1, 3)

The -1 means for all series so it should be picked up by the legend.

JuanC 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×