Page 1 of 1

[ANSWERED] legend ans scline with diffenret colors

Posted: Sat Mar 23, 2013 4:21 pm
by 16665441
I draw two scline
the first is green
the second is blue

I change the color of parts scline green and blue when they exceed a precise value.

I display the legend
I want the first item in the legend green.
I want the second item of the legend is blue

but as scline have 2 colors that does not work, the legend has a default color.

how to customize the color of the legend

Re: legend ans scline with diffenret colors

Posted: Mon Mar 25, 2013 11:59 am
by yeray
Hi,

The easiest way is to add two dummy series only for the legend. Then, you'll have 4 series, the two splines and the 2 dummies. And you can hide the splines from the legend, and use the dummies for it:

Code: Select all

  TChart1.Series(0).ShowInLegend = False
  TChart1.Series(1).ShowInLegend = False
  TChart1.Series(2).Color = vbGreen 'dummy1
  TChart1.Series(3).Color = vbBlue 'dummy 2

Re: legend ans scline with diffenret colors

Posted: Mon Mar 25, 2013 4:54 pm
by 16665441
yes I had thought of this.
but I also have checkbox on the items of the legend because I gives to the user the ability to hide or display series

Re: legend ans scline with diffenret colors

Posted: Tue Mar 26, 2013 10:52 am
by yeray
Hi,

You can use the OnMouseDown event to manually activate/deactivate the series you like when a legend item has been clicked.
Similar to this:
http://www.teechart.net/support/viewtop ... 26&p=61118