Hi,
Is there a way to have a TColorLineTool only visible when it intersects a ColorBand?
If you look at the attached image, I would like the orange line to be only visible within the gray area (ColorBand).
Thanks in advance for your help,
Charles
TColorLineTool only visible within ColorBand range
Re: TColorLineTool only visible within ColorBand range
Hi Charles,
The easiest solution would be to draw the horizontal line manually. Ie:
The easiest solution would be to draw the horizontal line manually. Ie:
Code: Select all
uses Series, TeeTools, TeCanvas;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
Chart1.Legend.Visible:=false;
Chart1.AddSeries(TFastLineSeries).FillSampleValues;
with Chart1.Tools.Add(TColorBandTool) as TColorBandTool do
begin
Axis:=Chart1.Axes.Bottom;
StartValue:=10;
EndValue:=15;
Transparency:=50;
Color:=clGray;
end;
end;
procedure TForm1.Chart1AfterDraw(Sender: TObject);
var StartX, EndX, PosY: Integer;
begin
with Chart1[0].YValues do
PosY:=Chart1.Axes.Left.CalcPosValue(MinValue + (MaxValue-MinValue)*2/3);
with Chart1.Axes.Bottom, (Chart1.Tools[0] as TColorBandTool) do
begin
StartX:=CalcPosValue(StartValue);
EndX:=CalcPosValue(EndValue);
end;
with Chart1.Canvas do
begin
Pen.Color:=clRed;
Line(StartX, PosY, EndX, PosY);
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: TColorLineTool only visible within ColorBand range
Hi Yeray,
thank you for your reply. But I still need to be able to drag up or down that line. This line represent a user adjustable setting.
Is there any way I could do that?
Regards
Charles
thank you for your reply. But I still need to be able to drag up or down that line. This line represent a user adjustable setting.
Is there any way I could do that?
Regards
Charles
Re: TColorLineTool only visible within ColorBand range
Hi Charles,
I'll add to the wish list the possibility to set a minimum and a maximum for the TColorLineTool (TV52016498).
In the meanwhile, I see two options:
- Improve the example above to add the features you require. You could use OnMouseMove event to change the Cursor to crVSplit when the mouse is over the line; and you could use the OnMouseDown, OnMouseUp and OnMouseMove events to implement the dragging feature.
- If you are SourceCode customer (I believe you are), you could modify the TColorLineTool to behave as you want. I guess with some modifications at the TColorLineTool.DrawColorLine method from TeeTools.pas would be enough for you.
I'll add to the wish list the possibility to set a minimum and a maximum for the TColorLineTool (TV52016498).
In the meanwhile, I see two options:
- Improve the example above to add the features you require. You could use OnMouseMove event to change the Cursor to crVSplit when the mouse is over the line; and you could use the OnMouseDown, OnMouseUp and OnMouseMove events to implement the dragging feature.
- If you are SourceCode customer (I believe you are), you could modify the TColorLineTool to behave as you want. I guess with some modifications at the TColorLineTool.DrawColorLine method from TeeTools.pas would be enough for you.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: TColorLineTool only visible within ColorBand range
Hi Yeray,
thank you for your suggestions, I will do that while waiting for an update that supports Min ans Max on a TcolorLineTool
Regards
Charles
thank you for your suggestions, I will do that while waiting for an update that supports Min ans Max on a TcolorLineTool
Regards
Charles