Hello,
I'm using Color Band's in my Chart. I've noticed that the filling will clip when it reaches the end of the Chart but Color Band borders don't. I see this happening whilst I tried scrolling my Chart.
Does anybody know what could be the case and how this can be solved?
Many thanks,
Robert Kleinpeter
Color Band clipping
Re: Color Band clipping
Hi Robert,
Is the following code reproducing the behaviour you are observing? Could you please attach a picture indicating where are you exactly viewing that?
I'm scrolling the chart up and down and I not sure to see anything strange.
Is the following code reproducing the behaviour you are observing? Could you please attach a picture indicating where are you exactly viewing that?
I'm scrolling the chart up and down and I not sure to see anything strange.
Code: Select all
uses series, teetools;
procedure TForm1.FormCreate(Sender: TObject);
var colorband: TColorBandTool;
begin
Chart1.View3D:=false;
Chart1.AddSeries(TFastLineSeries.Create(self));
Chart1[0].FillSampleValues(25);
with Chart1.Tools.Add(TColorBandTool.Create(self)) as TColorBandTool do
begin
Axis:=Chart1.Axes.Left;
StartValue:=Chart1[0].YValues.MinValue+((Chart1[0].YValues.MaxValue-Chart1[0].YValues.MinValue) / 3);
EndValue:=Chart1[0].YValues.MinValue+(2*(Chart1[0].YValues.MaxValue-Chart1[0].YValues.MinValue) / 3);
Pen.Color:=clRed;
Pen.Width:=3;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 3
- Joined: Fri Dec 11, 2009 12:00 am
Re: Color Band clipping
Hi Yeray,
After looking at my code for a very long time I finally found the reason why clipping doesn't occur... It has to do with the fact that I don't allow users to drag the Start & End line. I've alterd your example Form.Create code:
The last two lines are causing the clipping problem! But when I do allow drag, users are able to alter the min-max and that's not something I'd like.
I've noticed that (using the Chart Editor) it's not possible to configure ColorBands the way you would expect. When, for instance, you check the Startline 'Active', also 'Allow Drag' becomes checked when you refresh the settings. The same happens also the other way around. A little confusing I must say. I was not able to set every Startline to 'Active' and all 'Allow drag's to false using the GUI Editor.
By the way: I'm using Delphi 7 Pro and TeeChart version 8 with SC.
After looking at my code for a very long time I finally found the reason why clipping doesn't occur... It has to do with the fact that I don't allow users to drag the Start & End line. I've alterd your example Form.Create code:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var colorband: TColorBandTool;
begin
Chart1.View3D:=false;
Chart1.AddSeries(TFastLineSeries.Create(self));
Chart1[0].FillSampleValues(25);
with Chart1.Tools.Add(TColorBandTool.Create(self)) as TColorBandTool do
begin
Axis:=Chart1.Axes.Left;
StartValue:=Chart1[0].YValues.MinValue+((Chart1[0].YValues.MaxValue-Chart1[0].YValues.MinValue) / 3);
EndValue:=Chart1[0].YValues.MinValue+(2*(Chart1[0].YValues.MaxValue-Chart1[0].YValues.MinValue) / 3);
//Pen.Color:=clRed;
//Pen.Width:=3;
StartLine.Pen.Color := clRed;
StartLine.Pen.Width := 3;
StartLine.Active := True;
EndLine.Pen.Color := clRed;
EndLine.Pen.Width := 3;
EndLine.Active := True;
StartLine.AllowDrag := False;
EndLine.AllowDrag := False;
end;
end;
I've noticed that (using the Chart Editor) it's not possible to configure ColorBands the way you would expect. When, for instance, you check the Startline 'Active', also 'Allow Drag' becomes checked when you refresh the settings. The same happens also the other way around. A little confusing I must say. I was not able to set every Startline to 'Active' and all 'Allow drag's to false using the GUI Editor.
By the way: I'm using Delphi 7 Pro and TeeChart version 8 with SC.
Re: Color Band clipping
Hi Kleinpeter,
In that case you could check if the StartLine and EndLine TColorLineTool are in the axis range and activate or deactivate them. Something as follows:
In that case you could check if the StartLine and EndLine TColorLineTool are in the axis range and activate or deactivate them. Something as follows:
Code: Select all
procedure TForm1.Chart1Scroll(Sender: TObject);
var colorLine: TColorLineTool;
i: Integer;
begin
for i:=0 to Chart1.Tools.Count-1 do
begin
if (Chart1.Tools[i] is TColorBandTool) then
begin
colorLine:=(Chart1.Tools[i] as TColorBandTool).StartLine;
colorLine.Active:=((colorLine.Value < colorLine.Axis.Maximum) and (colorLine.Value > colorLine.Axis.Minimum));
colorLine:=(Chart1.Tools[i] as TColorBandTool).EndLine;
colorLine.Active:=((colorLine.Value < colorLine.Axis.Maximum) and (colorLine.Value > colorLine.Axis.Minimum));
end
else if (Chart1.Tools[i] is TColorLineTool) then
begin
colorLine:=(Chart1.Tools[i] as TColorLineTool);
colorLine.Active:=((colorLine.Value < colorLine.Axis.Maximum) and (colorLine.Value > colorLine.Axis.Minimum));
end;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 3
- Joined: Fri Dec 11, 2009 12:00 am
Re: Color Band clipping
Hi Yeray!
Problem solved!
Nice peace of code, that did the trick! Good workaround!
Happy Holidays!
Problem solved!
Nice peace of code, that did the trick! Good workaround!
Happy Holidays!