hello, browsing through your TeeChart Gallery.
The very first chart example, a gantt chart: How does one add that semi-transparent "overlay" effect, titled "holiday period." It's not another series, is it? How does one line it up with the correct dates? Can more than one overlay be added?
I guess a couple of lines of code as an example would be very helpful. (If the code for the gallery example is available somewhere, point me to it.)
Thanks and regards.
how to do chart like a gallery example
Hi.
Nope. It's a TColorBandTool tool, combined with annotation tool (for "Holiday period" caption). Alternatively, you could also manually drawn required text over the color band in the chart OnAfterDraw event. Something like this:It's not another series, is it?
Code: Select all
var x,y,th: Integer;
begin
x := Chart1.Axes.Bottom.CalcPosValue(ChartTool1.StartValue);
With Chart1.Axes.Left do
y := (IStartPos + IEndPos) div 2;
With Chart1.Canvas, Chart1 do
begin
ClipRectangle(ChartRect);
Font.Height := -13;
Font.Color := clNavy;
th := TextHeight('W');
TextOut(x+20,y-(th div 2),'Holiday period');
UnclipRectangle;
end;
end;
By setting the colorband tool StartValue and EndValue. Here is an example where start and end value are set to specific datetime range:How does one line it up with the correct dates?
Code: Select all
endDate := EncodeDate(2004,9,10);
Chart1.Axes.Bottom.SetMinMax(endDate-45,enddate);
colorBandTool1.Axis := Chart1.Axes.Bottom;
colorBandTool1.StartValue := EncodeDate(2004,8,6);
colorBandTool1.EndValue := EncodeDate(2004,8,21);
colorBandTool1.Transparency := 50;
Yes (add multiple instances at design or at runtime).Can more than one overlay be added?
Marjan Slatinek,
http://www.steema.com
http://www.steema.com