TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
-
Friis
- Newbie
- Posts: 23
- Joined: Mon May 07, 2012 12:00 am
Post
by Friis » Thu Nov 15, 2012 10:55 am
Hi,
Two questions:
1) I would like to put a brush on a TGanttSeries - the code below doesn't allow me to do that? How do I assing the Brush to the TGanttseries??
2) Is it possible to assing different types of Brush to different Points in the same GanttSeries? How do I do that?
Code: Select all
procedure TForm10.FormCreate(Sender: TObject);
var
ABitmap : TBitmap;
s : shortstring;
begin
ABitmap := TBitmap.Create;
GetTeeBrush(3,ABitmap);
with Chart1.AddSeries(TGanttSeries.Create(self)) as TGanttSeries do
begin
ParentChart := Chart1;
ColorEachPoint := true;
pointer.Brush.Image.Assign(ABitmap);
Title := 'PO Planned';
ShowInLegend := true;
XValues.Order:=loNone;
Marks.visible := true;
Marks.Transparent := true;
Xvalues.DateTime := true;
with Chart1[Chart1.SeriesCount-1] as TGanttSeries do
begin
Pointer.VertSize:=10;
s := 'hej';
AddGantt(now,now+1,-1,s);
end;
end;
end;
-
Yeray
- Site Admin
- Posts: 9613
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Fri Nov 16, 2012 3:33 pm
Hello Hans,
It seems that the patterns based on images work fine with the TLineSeries, but the don't with the TPointSeries nor with the TGanttSeries. I've added it to the defect list to be revised for next releases (TV52016419).
However, the regular patterns seem to work fine. And you could change the pattern depending on the ValueIndex, at the OnGetPointerStyle event:
Code: Select all
private
{ Private declarations }
Function SeriesGetPointerStyle(Sender:TChartSeries; ValueIndex:Integer):TSeriesPointerStyle;
//...
procedure TForm1.FormCreate(Sender: TObject);
begin
with Chart1.AddSeries(TGanttSeries) as TGanttSeries do
begin
Pointer.VertSize:=10;
FillSampleValues(10);
OnGetPointerStyle:=SeriesGetPointerStyle;
end;
end;
Function TForm1.SeriesGetPointerStyle(Sender:TChartSeries; ValueIndex:Integer):TSeriesPointerStyle;
begin
Chart1.Canvas.Brush.Style:=TBrushStyle(2+(ValueIndex mod 6));
result:=psRectangle;
end;