BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TChart Legends

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Reporting-Charting
View previous topic :: View next topic  
Author Message
Patrick Hughes
Guest





PostPosted: Sat Jan 06, 2007 2:16 am    Post subject: TChart Legends Reply with quote



I'm trying to get the legend to display only alternate bar series labels but
I'm having trouble figuring how.

Here's what I'm attempting:

with BarSeries1 do
begin
Add(2.0, 'Label1', $00C7B189);
Add(3.0, 'Label2', $00C7B189);
Add(4.0, 'Label3', $005EE9F4);
Add(5.0, 'Label4', $005EE9F4);
Add(6.0, 'Label5', $009395EE);
Add(7.0, 'Label6', $009395EE);
end;

The resulting legend would be:

Label1 (color $00C7B189)
Label3 (color $005EE9F4)
Label5 (color $009395EE)

Using D5 & TChart Standard version 4

Thanks for any help,


--
Patrick Hughes
Back to top
Narcís Calvet
Guest





PostPosted: Wed Jan 17, 2007 5:44 pm    Post subject: Re: TChart Legends Reply with quote



Hi Patrick,

The only way I can think of is using TChart's OnGetLegendText like this:

procedure TForm1.Chart1GetLegendText(Sender: TCustomAxisPanel;
LegendStyle: TLegendStyle; Index: Integer;
var LegendText: String);
begin
if index mod 2 <> 0 then
legendText := ''
else
legendText := legendText;
end;
end;


--
Best Regards,

Narcis Calvet
Steema Support Central
http://support.steema.com

"Important note: If you are a TeeChart registered customer, please post your
support questions at Steema's Support monitored Forums for customers:
http://support.steema.com for a prompter reply."

Patrick Hughes wrote:
Quote:
I'm trying to get the legend to display only alternate bar series
labels but I'm having trouble figuring how.

Here's what I'm attempting:

with BarSeries1 do
begin
Add(2.0, 'Label1', $00C7B189);
Add(3.0, 'Label2', $00C7B189);
Add(4.0, 'Label3', $005EE9F4);
Add(5.0, 'Label4', $005EE9F4);
Add(6.0, 'Label5', $009395EE);
Add(7.0, 'Label6', $009395EE);
end;

The resulting legend would be:

Label1 (color $00C7B189)
Label3 (color $005EE9F4)
Label5 (color $009395EE)

Using D5 & TChart Standard version 4

Thanks for any help,
Back to top
Patrick Hughes
Guest





PostPosted: Thu Jan 18, 2007 10:09 pm    Post subject: Re: TChart Legends Reply with quote



Thanks Narcis, I'll give it a try.

--
Patrick Hughes

"Narcís Calvet" <support (AT) steema (DOT) com> wrote in message
news:45ae0be7$1 (AT) newsgroups (DOT) borland.com...
Quote:
Hi Patrick,

The only way I can think of is using TChart's OnGetLegendText like this:

procedure TForm1.Chart1GetLegendText(Sender: TCustomAxisPanel;
LegendStyle: TLegendStyle; Index: Integer;
var LegendText: String);
begin
if index mod 2 <> 0 then
legendText := ''
else
legendText := legendText;
end;
end;


--
Best Regards,

Narcis Calvet
Steema Support Central
http://support.steema.com
Back to top
Chuck Yetter
Guest





PostPosted: Thu Mar 29, 2007 10:18 pm    Post subject: Re: TChart Legends Reply with quote

I had the same problem of trying to have the bottom axis display every other
label, and I finally got it to work after reading Narcis' suggestion, but by
using the OnGetAxisLabel event handler instead. The OnGetLegendText event
handler wasn't working in my case.

void __fastcall TTestReview::TrendChartGetAxisLabel(TChartAxis *Sender,
TChartSeries *Series, int ValueIndex, AnsiString &LabelText)
{
if((ValueIndex % 2) != 0){
LabelText = "";
}
}

Chuck Yetter


"Patrick Hughes" <duhvinci@-RemoveThis-engds.com> wrote in message
news:45af9c26 (AT) newsgroups (DOT) borland.com...
Quote:
Thanks Narcis, I'll give it a try.

--
Patrick Hughes

"Narcís Calvet" <support (AT) steema (DOT) com> wrote in message
news:45ae0be7$1 (AT) newsgroups (DOT) borland.com...
Hi Patrick,

The only way I can think of is using TChart's OnGetLegendText like this:

procedure TForm1.Chart1GetLegendText(Sender: TCustomAxisPanel;
LegendStyle: TLegendStyle; Index: Integer;
var LegendText: String);
begin
if index mod 2 <> 0 then
legendText := ''
else
legendText := legendText;
end;
end;


--
Best Regards,

Narcis Calvet
Steema Support Central
http://support.steema.com


Back to top
Chuck Yetter
Guest





PostPosted: Thu Mar 29, 2007 10:56 pm    Post subject: Re: TChart Legends Reply with quote

Oops, never mind. This thread is on Legends and I am thinking of Labels.
:)

Chuck
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Reporting-Charting All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.