Home › forums › Using CanvasJS › Color of bubble/scatter series
This topic contains 5 replies, has 4 voices, and was last updated by herryswastika 5 months, 2 weeks ago.
Is there a setting to keep the color of scatter and bubble plots the same when there’s only one series? It looks if there is only 1 series the color of each bubble is different. Where as if there’s two or more series, the series color sticks and each member of that series is the same.
I know I can pass color back in the data object to hard code it, but can i just turn off the multi-color option?
You can set the color of entire series by using color property in dataSeries. There is no option to turn off multi-color option other than that.
The problem is, I generate a lot of charts on the page dynamically and I don’t know in advance how many series there will in a given chart nor how many charts there will be on a given page. For 2 or more series it works as expected (each series it’s own color) but for 1 it does not. I’m not sure I can easily specify the color of the dataSeries for the case where there’s only one.
If your charts are dynamic and the number of dataSeries / charts cannot be estimated before hand,
set() method can be used after the chart is rendered to set a predefined color in case of only one dataSeries. Please check this jsfiddle.
Thanks! This works for the time being.
This package is soo great. I use scatter chart, and I just use leftjoin, and selectRaw with coloumname as color, and the chart automatically depict the colors. I dont have to modify my chart scripts. awesome!!
You must be logged in to reply to this topic.