Sets the colorSet of StockChart. Color Set is an array of colors that are used to set the color of individual dataSeries in a sequence. Various predefined Color Sets are bundled along with the library. You can either choose from the pre-defined Color Sets or define your own Color Set as shown in this tutorial.
CanvasJS provides a way to add custom colorSet to the library. Color Sets added in this manner are globally available and can be used by any dataSeries in the StockChart.
Syntax: CanvasJS.addColorSet(colorSetName, colorSetArray)
CanvasJS.addColorSet("customColorSet1", [//colorSet Array "#4661EE", "#EC5657", "#1BCDD1", "#8FAABB", "#B08BEB", "#3EA0DD", "#F5A52A", "#23BFAA", "#FAA586", "#EB8CC6", ]);
Once a Color Set is added, you can refer it by its name – similar to pre-defined ones. Below is the syntax showing how to refer it.
var stockChart = new CanvasJS.StockChart("container", { . . colorSet: "customColorSet1", . }); stockChart.render();
Also See:
Server Side Technologies |
Front End Technologies |
Contact |
|
---|---|---|---|
ASP.NET MVC Charts | JavaScript Charts | FAQs | |
PHP Charts | jQuery Charts | Sales Enquiries | |
Spring MVC Charts | React Charts | Support Forum | |
JSP Charts | Angular Charts | Careers | |
JavaScript StockCharts | |||
Privacy Policy © fenopix