Home forums Using CanvasJS Color of bubble/scatter series

This topic contains 4 replies, has 3 voices, and was last updated by  Igor 9 months, 2 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #14379

    Igor
    Member

    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?

    #14380

    Bivek Singh
    Moderator

    Reynaldo,

    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.

    ——
    Bivek Singh

    #14392

    Igor
    Member

    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.

    #14399

    Suyash Singh
    Moderator

    Reynaldo,

    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.

    __

    Suyash Singh
    Team CanvasJS

    #14404

    Igor
    Member

    Thanks! This works for the time being.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.