JqPlot Pie Chart - Changing the colors of a piece of cake

I have a pie chart showing the use of JqPlot. I would be interested in changing the actual colors of the cut and still have no luck.

I stumbled upon this link and tried the solution, but I'm not sure if I put it in the wrong place (Have tried to paste it in several places in the code), since when I have it, the pie chart no longer displays (and actually stops display of other diagrams on the page).

Here is the javascript code for the pie chart:

$(document).ready(function () {
        var data = [['US',33], ['IE',30], ['GB',23], ['AU',7], ['CA',4], ['RoW',7]];
        var plot1 = jQuery.jqplot('Countries', [data],
        {
            seriesDefaults: {
                // Make this a pie chart.
                renderer: jQuery.jqplot.PieRenderer,
                rendererOptions: {
                    // Put data labels on the pie slices.
                    // By default, labels show the percentage of the slice.
                    sliceMargin: 5,
                    showDataLabels: true,
                }
            },
            legend: { show: true, border: false, /*placement: 'outsideGrid', location: 'w'*/location: 'e', border: 'none' },
            grid: {borderWidth:0, shadow:false, background: '#FFFFFF'}

        }
      );
    });

Does anyone have any ideas?

+5
source share
1 answer

You can apply seriesColorsto an object options, for example:

options =
{
    seriesColors: [ "#4bb2c5", "#c5b47f", "#EAA228", "#579575" ]
}

jqPlot Options.

+16

All Articles