Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change color of each bar in TChart seperately during runtime

Status
Not open for further replies.

pascalsv

Programmer
Jan 23, 2003
5
0
0
DE
Hi there,

I need to change the color of each bar in my TChart-graph according to its value during runtime. How could this be done?

Thanks for any help!!!

Pascal
 
Try this - I use a similar function with datapoints in a scatter chart
[tt]
Series1.ValueColor[J] := clRed; // or whatever you like
[/tt]

Series1 is declared in your Type statements by the TChart object.

You can manipulate the chart itself like this...
[tt]
with QRChart_CUSUM do begin
Title.Text.Clear;
Title.Text.Add('SHEWHART chart for ' + phantom);
Title.Text.Add('baseline file: ' + primaryfile + ' ROI: ' + CurrROI{RG_ROIChoice.Items[RG_ROIChoice.itemindex]});
LeftAxis.Title.Caption := 'SD from mean';
LeftAxis.AutomaticMaximum := false;
LeftAxis.AutomaticMinimum := false;
LeftAxis.Maximum := 5;
LeftAxis.Minimum := -5;
LeftAxis.TickLength := 1;
BottomAxis.Title.Caption := 'Time (scan date)';

Foot.Text.Clear;
Foot.Text.Add('Baseline BMD: Average = ' + FloatToStrF(avgBMD,ffGeneral,5,3) + ' ' + #177 + FloatToStrF(sdBMD,ffGeneral,5,3));

end;
[/tt]

For bars, the help file suggests...
[tt]
BarSeries1.BarBrush.Style := bsFDiagonal;
BarSeries1.BarBrush.Color := clWhite;
BarSeries1.SeriesColor := clRed;
[/tt]

Check out:
the help file Progra~1\Borland\Delphix\Help\TEECHART.HLP
the TeeChart web site the demo programs supplied in C:\Program Files\Borland\Delphi7\Demos\TeeChart]

Cheers


Chris ;-)
 
Hi Chris and thanks for your quick help. That is exactly the information I was searching for for days!! Unfortunately the online help of TeeChart is quite thin!!

:(

Greetings,

Pascal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top