Forum Discussion

rszucker's avatar
rszucker
New Contributor
15 years ago

Setting ChartModel Series Colors

Hello,

I'm currently trying to write a custom component that extends your Statistics component. When I run my custom component, the data series on the graph is set to a dark green and the legend is set to black. How do I explicitly set the color for each data series that I add (chartModel.addSerie ...) to the ChartModel?

Thanks and regards, Robert
  • Hi Robert!

    Is your main problem that "the data series on the graph is set to a another color than its legend" (if so, sounds like a bug that we should fix) or that you for some other reason want's to specify the colors?

    Please let us know

    /Henrik
    loadUI team
  • rszucker's avatar
    rszucker
    New Contributor
    Hi Henrik,

    Thanks for your reply. It appears that after the basic set of statistics (Maximum thru Failed), if I try to add any additional series, the legend label color is black and the chart display uses the last color that was set (dark green for Failed in this case).

    I thought that if I could explicitly set the legend label colors, that would solve the chart display issue as well. But I can't seem to find anywhere in the API documentation where you can explicitly set chart model colors after you add a series. Any suggestions?

    Thanks in advance, Robert
  • rszucker wrote:
    Thanks for your reply. It appears that after the basic set of statistics (Maximum thru Failed), if I try to add any additional series, the legend label color is black and the chart display uses the last color that was set (dark green for Failed in this case).

    I thought that if I could explicitly set the legend label colors, that would solve the chart display issue as well. But I can't seem to find anywhere in the API documentation where you can explicitly set chart model colors after you add a series. Any suggestions?[/attachment]

    You are not able to specify colors from the API. Colors are not bound to certain statistics, but are just assigned to statistics in a first-come-first-serve fashion (whether they're the default set of statistics or your own).

    It seems to me that showing 30-40 series in the same chart would be hard to read regardless of which colors you chose, but on the other hand I think that we could add more colors to the default 16 set of colors if that would help you (I guess you could add ~8 more colors and still be able to tell them apart).

    Sorry if this post sound overexplicit -- you probably know most of these things already

    /Henrik
    loadUI team