TBarSeries
Posted: Wed Jan 28, 2004 12:36 pm
Hi
I'm trying to make a bar series with the different segments having a different color AND BRUSH STYLE. Using the AddXY funtion allows me to add values and specifying a color, but how to specify a Brush style only to be used for the specific value. When I use the TBarSeries.Brush or TBarSeries.BarBrush properties I set ALL of the values.....
Here is my test example. put a button and a Chart on the form, set the chart's View3D property set to false:
Hope somone has an answer !
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, TeeProcs, TeEngine, Chart, Series,TeCanvas;
type
//
TLayer = record
Depth : Single;
Color : TColor;
Text : String;
end;
TLayers = array of TLayer;
TForm1 = class(TForm)
Chart1: TChart;
Button1: TButton;
procedure Button1Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
I : integer;
NLay : Integer;
Layers : TLayers;
Series : TBarSeries;
begin
NLay := 5;
//Make the Bar serie
Chart1.FreeAllSeries();
Series := TBarSeries.Create(Chart1);
Series.ParentChart := Chart1;
Series.MultiBar := mbNone;
Series.Marks.Visible := False;
Series.UseYOrigin := True;
for I := NLay downto 0 do begin
Series.AddXY(100, I*10,'Layer : ' +IntToStr(I),clGreen);
if I=1 then begin
with Series.BarBrush do begin
Color := clYellow;
Style := bsSolid;
end;
end else begin
with Series.BarBrush do begin
Color := clYellow;
Style := bsDiagCross;
end;
end;
end;
end;
end.
I'm trying to make a bar series with the different segments having a different color AND BRUSH STYLE. Using the AddXY funtion allows me to add values and specifying a color, but how to specify a Brush style only to be used for the specific value. When I use the TBarSeries.Brush or TBarSeries.BarBrush properties I set ALL of the values.....
Here is my test example. put a button and a Chart on the form, set the chart's View3D property set to false:
Hope somone has an answer !
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, TeeProcs, TeEngine, Chart, Series,TeCanvas;
type
//
TLayer = record
Depth : Single;
Color : TColor;
Text : String;
end;
TLayers = array of TLayer;
TForm1 = class(TForm)
Chart1: TChart;
Button1: TButton;
procedure Button1Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
I : integer;
NLay : Integer;
Layers : TLayers;
Series : TBarSeries;
begin
NLay := 5;
//Make the Bar serie
Chart1.FreeAllSeries();
Series := TBarSeries.Create(Chart1);
Series.ParentChart := Chart1;
Series.MultiBar := mbNone;
Series.Marks.Visible := False;
Series.UseYOrigin := True;
for I := NLay downto 0 do begin
Series.AddXY(100, I*10,'Layer : ' +IntToStr(I),clGreen);
if I=1 then begin
with Series.BarBrush do begin
Color := clYellow;
Style := bsSolid;
end;
end else begin
with Series.BarBrush do begin
Color := clYellow;
Style := bsDiagCross;
end;
end;
end;
end;
end.