Dear,
I'm looking for Javascript SDK sample code of changing "seriesColors" attribute of a chart.
Thank you in advance.
Using the chart sample that ships with the SDK, here is a small change to add seriesColors:
function(results, job, callback) {
splunkjs.UI.ready(chartToken, function() {
chart.setData(results, {
"chart.stackMode": "stacked",
"seriesColors": "[0xff0000, 0x00ff00]"
});
chart.draw();
callback(null, job);
});
}
As you can see, we simply set the 'seriesColors' attribute. Note that it needs to be a string with an array in it, as this is what the charting library expects.
Using the chart sample that ships with the SDK, here is a small change to add seriesColors:
function(results, job, callback) {
splunkjs.UI.ready(chartToken, function() {
chart.setData(results, {
"chart.stackMode": "stacked",
"seriesColors": "[0xff0000, 0x00ff00]"
});
chart.draw();
callback(null, job);
});
}
As you can see, we simply set the 'seriesColors' attribute. Note that it needs to be a string with an array in it, as this is what the charting library expects.
Thank you so much!!