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 

TeeChart Pro Help Please

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





PostPosted: Wed Mar 16, 2005 1:09 pm    Post subject: TeeChart Pro Help Please Reply with quote



I have a Quickreport form with a graph on it which is populated with a
dataset.


There are always 11 bars but I want bars 1, 3, 5,7,9,11 to be Excel pale
blue and bars 2,4,6,8,10 to be a Excel pale orange.


Can I do this by passing code before I preview ie)
Report1.QRChart1.Chart.Series[0].Color etc and if so what would be the
proper syntax ?


Any help/example code would be appreciated.


Regards



Tim


Back to top
Marjan Slatinek
Guest





PostPosted: Wed Mar 16, 2005 3:18 pm    Post subject: Re: TeeChart Pro Help Please Reply with quote



Hi, Tim.

Quote:
There are always 11 bars but I want bars 1, 3, 5,7,9,11 to be Excel pale
blue and bars 2,4,6,8,10 to be a Excel pale orange.


If you want bars with odd index number to have different color from the bars
with even index number, then you could use the following code:

With QRChart1.Chart.Series[0] do
begin
ColorEachPoint := True;
for i := 0 to Count -1 do
if i mod 2 = 0 then ValueColor[i] := RGB(153,204,255)
else ValueColor[i] := RGB(255,153,0);
end;

You can call this code after the series is already populated with data.
Alternatively, you can also place it in TChartSeries.OnAfterAdd event. In
this case, a bit more complex code is needed:

procedure TForm1.SeriesAfterAddEvent(Sender: TChartSeries;
ValueIndex: Integer);
begin
if ValueIndex mod 2 = 0 then Sender.ValueColor[ValueIndex] :=
RGB(153,204,255)
else Sender.ValueColor[ValueIndex] := RGB(255,153,0);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
With QRChart1.Chart.Series[0] do
begin
OnAfterAdd := SeriesAfterAddEvent; // Assign event
ColorEachPoint := True;
// add sample points
Add(2,'',clTeecolor);
Add(3,'',clTeecolor);
Add(4,'',clTeecolor);
Add(2,'',clTeecolor);
Add(7,'',clTeecolor);
Add(3,'',clTeecolor);
end;
end;

I'd use second solution (assigning OnAfterAdd event and changing point color
after it's added to series).
--
Regards,

Marjan Slatinek
TeeChart Support
[email]marjan (AT) steema (DOT) com[/email]
--------------------------------------
"Tim Horn" <tim (AT) umbani (DOT) com> wrote

Quote:
I have a Quickreport form with a graph on it which is populated with a
dataset.


There are always 11 bars but I want bars 1, 3, 5,7,9,11 to be Excel pale
blue and bars 2,4,6,8,10 to be a Excel pale orange.


Can I do this by passing code before I preview ie)
Report1.QRChart1.Chart.Series[0].Color etc and if so what would be the
proper syntax ?


Any help/example code would be appreciated.


Regards



Tim





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.