Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
958
how to change fill color of boxes in line chart legend?
posted

Hello,

how can I change the fill color of the boxes in a line chart legend?

I have a line chart with 3 lines, each with a different color. Of course I want that colors in the legend as well. At the moment only one color is used for all three boxes.

Where does the legend get the fill color for the boxes from?

Thanks in advance and best regards,

Gerald

  • 28496
    Offline posted

     the Legend gets the fill color from a variety of places, depending on the settings of the Chart color model and other color settings on the chart like the Overrides collection and the Series.PEs collection(s).  the colors should match your chart, unless you are doing some custom stuff to re-color the lines.  if that's the case, you could handle ChartDrawItem to find the Box primitives in the Legend (evaluate primitive.Path.IndexOf("Legend") to see if it's a legend item) and re-color the boxes there.