How do I change the legend range/level for TColorGridSeries

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Fang
Newbie
Newbie
Posts: 66
Joined: Wed Oct 13, 2004 4:00 am

How do I change the legend range/level for TColorGridSeries

Post by Fang » Sat Apr 01, 2006 6:46 pm

For TColorGridSeries, how do I set the range of legend (Y value) manually, ex from 0 to 1 and show 5 levels in between, like the contour plot levels.

thanks.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Apr 03, 2006 8:50 am

Hi Fang,

You should create your own palette levels as told here.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Fang
Newbie
Newbie
Posts: 66
Joined: Wed Oct 13, 2004 4:00 am

Post by Fang » Mon Apr 03, 2006 1:15 pm

Code: Select all

 
	Series1->FillSampleValues(32);
	Series1->UsePalette =true;
	Series1->UseColorRange = false;
	Series1->ClearPalette();
	Series1->AddPalette(0,clYellow);
	Series1->AddPalette(0.5,clGreen);
	Series1->AddPalette(1,clRed);
I tried the above code, but isn't quite what I want. I just don't want the lengend to show that many levels, but I do want the color to be smooth out in between.
But then I tried to set UseColorRange to true, it seems working but using colorrange color not the palette color. Am I doing right? Thanks.

Fang
Newbie
Newbie
Posts: 66
Joined: Wed Oct 13, 2004 4:00 am

Post by Fang » Mon Apr 03, 2006 1:31 pm

Basically I want a long legend bar (continous color, which can be set) with only a few number besides it, like this.

|| 1.0
||
||
||
|| 0.5
||
||
||
|| 0.0

Most of the color annotated graph has a legend like that instead of like
|| 1.1034
|| 0.9453
|| 0.8545
|| 0.7434
|| 0.6434
|| 0.5344
|| 0.4343
|| 0.3323
|| 0.2344

Badly needed. Thanks.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Apr 03, 2006 1:52 pm

Hi Fang,

To achieve that you can use OnGetLegendText and set to an empty string the values you don't want to be displayed and modify the ones you want.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Fang
Newbie
Newbie
Posts: 66
Joined: Wed Oct 13, 2004 4:00 am

Post by Fang » Mon Apr 03, 2006 2:10 pm

it'll be great if you guys add a feature like this.

'Cause esentially the legend for TColorGrid is another axis Y, I want to be able to adjust this axis as easy as other axises. Ex. set a range and steps

Thanks.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Apr 03, 2006 2:21 pm

Hi Fang,

You can also have that legend customly drawing on TeeChart's canvas.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Fang
Newbie
Newbie
Posts: 66
Joined: Wed Oct 13, 2004 4:00 am

Post by Fang » Mon Apr 03, 2006 2:39 pm

Code: Select all

	Series1->UseColorRange = true;
	Series1->ClearPalette();
	for (size_t i=0; i <= 40; i++)
		Series1->AddPalette(0.025*i,clTeeColor);


void __fastcall TForm1::Chart1GetLegendText(TCustomAxisPanel *Sender,
	  TLegendStyle LegendStyle, int Index, AnsiString &LegendText)
{
	int m=Index-(Index/4)*4;
	if (m!=0) LegendText="";
}
I used the above code and it almost worked except that the funny thing is that the lenght of this legend bar is dependent on the number of palettes.

beetle
Newbie
Newbie
Posts: 59
Joined: Fri Dec 12, 2003 5:00 am

Post by beetle » Mon Apr 03, 2006 3:27 pm

Hi Fang,

You can get a continuous legend doing one of these things:
- Setting chart->Legend->VertSpacing less than 0 (I have set -10)
- or setting chart->Legend->Symbol->Continuous = true; (Legend Symbols tab)

And for the legend texts, you should use a coefficient dependant on the
number of palleteSteps (series->PalleteSteps)

Beetle.

Fang
Newbie
Newbie
Posts: 66
Joined: Wed Oct 13, 2004 4:00 am

Post by Fang » Mon Apr 03, 2006 4:13 pm

thanks Beetle. I'm doing that :)

Post Reply