[ANSWERED] legend ans scline with diffenret colors

TeeChart for ActiveX, COM and ASP
Post Reply
jika
Newbie
Newbie
Posts: 27
Joined: Mon Mar 18, 2013 12:00 am

[ANSWERED] legend ans scline with diffenret colors

Post by jika » Sat Mar 23, 2013 4:21 pm

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
Last edited by jika on Tue Apr 09, 2013 8:21 am, edited 1 time in total.

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: legend ans scline with diffenret colors

Post by Yeray » Mon Mar 25, 2013 11:59 am

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
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

jika
Newbie
Newbie
Posts: 27
Joined: Mon Mar 18, 2013 12:00 am

Re: legend ans scline with diffenret colors

Post by jika » Mon Mar 25, 2013 4:54 pm

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

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: legend ans scline with diffenret colors

Post by Yeray » Tue Mar 26, 2013 10:52 am

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
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply