In this article you will learn about how to add Background Color to a chart using. By default the background color of any chart created via Adhoc is White.
Now, to change the background color of a chart will require javascript as well as CSS code. First we will apply javascript code and then CSS style code to generate the output.
Javascript Code :
hi_container.set("postExecution", function () {
$('g.c3-chart > g.c3-event-rects').removeAttr('style'); // code used to remove style
});
CSS Code :
g.c3-chart > g.c3-event-rects{
fill:yellow; // code used to add style after removing previous one using script
} // we can specify the color name or hex code.
Also, you can define the name of color or hex code in CSS style.
You can also change the background color of any chart like Areachart, splinechart, Scatter Chart, Step Chart and so on. Similarly, in addition you can add other CSS and Javascript code for more customizations.
For more info, contact us at support@helicalinsight.com