Get Colorset of the theme - CanvasJS JavaScript Charts
Get Colorset of the theme - CanvasJS JavaScript Charts
by canvasjs
HTML
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<br/><!-- Just so that JSFiddle's Result label doesn't overlap the Chart -->
<div id="chartContainer" style="height: 360px; width: 100%;"></div>
<button id="button">Get Colors</button>
JavaScript
var chart = new CanvasJS.Chart("chartContainer", {
data: [
{
type: "column",
dataPoints: [
{ x: 1, y: 5 },
{ x: 2, y: 9 },
{ x: 3, y: 17},
{ x: 4, y: 32},
{ x: 5, y: 22},
{ x: 6, y: 14},
{ x: 7, y: 25},
{ x: 8, y: 18},
{ x: 9, y: 20}
]
}
]
});
chart.render();
document.getElementById("button").addEventListener("click", function(){
var colorSet = chart.selectedColorSet;
console.log(colorSet)
})