This topic is locked

Change color in pie chart

3/21/2017 1:17:22 PM
PHPRunner General questions
F
fabiofurlan author

how to Change the color of the slice in pie chart ?

admin 3/21/2017

Use Javascript ChartModify event and here is the sample code:

var palette = anychart.palettes.distinctColors();

palette.items(["#64B5F6", "#2374B8", "#97BDC1", "#FFD54F", "#EF6C00", "#0AB4DE", "#CFAE83"]);

chart.palette(palette);


If your pie chart has more slices than colors you specify colors will be repeated.

B
buddymoots 3/22/2017

Thank you Sergey
Is it possible to put the labels in the segments, rather than the values?
Sim

admin 3/22/2017

@Buddy Moots
try this:

chart.labels().textFormatter("{%x}");
B
buddymoots 3/22/2017



@Buddy Moots
try this:

chart.labels().textFormatter("{%x}");



Thank you Sergey, that works, however if the value is too long, it does not display a label.
In previous versions the pie and ring chart looked like this


Is this chart format no longer available?
Sim

admin 3/22/2017

We got you covered:

chart.labels().position("outside");
B
buddymoots 3/22/2017



We got you covered:

chart.labels().position("outside");



Lol, thanks Sergey, you the man. I was just about to post that from the AnyChart site.
This works very well

chart.labels().textFormatter("{%x}");

chart.labels().position("outside");


Is it also possible to modify the guage chart to look like this Solid Guage?

F
fabiofurlan author 4/6/2017

hello, please My graph and this in the attached example, I applied as commented but did not have any effect did not load the colors I reported in the ChartModify event



Use Javascript ChartModify event and here is the sample code:

var palette = anychart.palettes.distinctColors();

palette.items(["#64B5F6", "#2374B8", "#97BDC1", "#FFD54F", "#EF6C00", "#0AB4DE", "#CFAE83"]);

chart.palette(palette);


If your pie chart has more slices than colors you specify colors will be repeated.


F
fabiofurlan author 4/7/2017

hello, Sorry the problem was in google chrome when clearing the history introduced the custom colors
[quote name='Fabio Furlan de Carvalho' date='06 April 2017 - 05:53 PM' timestamp='1491512026' post='81896']

hello, please My graph and this in the attached example, I applied as commented but did not have any effect did not load the colors I reported in the ChartModify event