Change color on ChartJS pie chart

Contents

Description

Charts usually support custom options appropriate to that visualization. You can use it for adding options that are available in Chart.js API. In this callback, in the method wpDataChartsCallbacks 82 is the ID of the chart for which you want to change colors. We used hex color codes with some random colors, but you can change them for your needs. There are six of them (if you have six series), if you have more then you have to add more colors in the colors array, separated by a comma (except the last one). On the end insert this script above the shortcode of your chart on the page.

Examples