Tchart Pro vsn 8.06
Chart with a few Tlineseries drawing X,Y graphs
I have lineseries.pointer.size = 1, lineseries.pointer.visible=false
so the graph draws just a linebetween the x,y points, the actual points not being displayed on chart
If I alter lineseries.pen.width it alters thw width of the line connecting the x,y points, which is the effect I want.
However, I have the legend set to show each lineseries so there is a checkbox, the series name, and between the checkbox and series name there
is a short line the same colour as the series colour configured. This is default Tchart display, I'm not using custom draw for legend.
When I alter lineseries.pen.width it also alters the width of the line that is shown in the legend, my question is can I prevent this?
I want legend line width to be fixed at 3, but user to be able to set grap line width to different settings
thanks
Sean
legen symbol pen width
-
- Newbie
- Posts: 19
- Joined: Thu Sep 27, 2007 12:00 am
- Location: UK
- Contact:
Re: legen symbol pen width
Hi Sean,
I'm afraid that the pens drawn in the legend symbols are linked to the series, so there isn't an option to change them. However, you can use the legend's symbol's event OnDraw to customize them. Something similar to the demo at All Features/Welcome !/Miscellaneous/Legend/Symbol OnDraw
I'm afraid that the pens drawn in the legend symbols are linked to the series, so there isn't an option to change them. However, you can use the legend's symbol's event OnDraw to customize them. Something similar to the demo at All Features/Welcome !/Miscellaneous/Legend/Symbol OnDraw
Code: Select all
uses series, TeCanvas;
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
Chart1.View3D := false;
for i:=0 to 4 do
begin
Chart1.AddSeries(TLineSeries.Create(self));
Chart1[i].FillSampleValues();
end;
Chart1.Legend.Symbol.OnDraw:=LegendDraw;
end;
procedure TForm1.LegendDraw(Sender: TObject; Series: TChartSeries;
ValueIndex: Integer; R: TRect);
var YPos: Integer;
begin
with Chart1.Canvas do
begin
if Chart1.Legend.Symbol.Pen.Visible then
begin
//clear the symbol
Brush.Style:=bsSolid;
Pen.Style:=psClear;
Rectangle(R,0);
//draw the new symbol
Pen.Style:=psSolid;
Pen.Color:=Series.Color;
Pen.Width:=3;
YPos:=(R.Bottom-R.Top) div 2 + R.Top;
Line(R.Left,YPos,R.Right,YPos);
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: 19
- Joined: Thu Sep 27, 2007 12:00 am
- Location: UK
- Contact:
Re: legen symbol pen width
thanks Yeray, I'll try that way.
Sean
Sean