Page 1 of 1

about chart line style ,width

Posted: Wed Dec 13, 2006 3:21 am
by 9348298
Hi

I want to build a popmenu include 'linestyle' 'linewidth' 'linecolor' 'linemarks' etc. When custom Press the Item runtime, the according dialog pop up . which tool can I use in chart ?how to use?

Posted: Wed Dec 13, 2006 8:58 am
by narcis
Hi hexfhhu,

You can use TeeChart's and Series' mouse related events to check what's being selected. However TeeChart doesn't have a pop-up menu component. For this you'll have to use Delphi standard components or other 3rd party components.

Posted: Wed Dec 13, 2006 12:48 pm
by 9348298
hi Narcís

You are right . I have builded a popmenu , I do not known how to change series width, color,style, the series I have get from following code :

procedure TFormShowLinebak.Chart1ClickSeries(Sender: TCustomChart;
Series: TChartSeries; ValueIndex: Integer; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if (ValueIndex > 0) and (Button=mbRight)and (Series<>nil) then
begin
MenuLineColor.Enabled:=True;
MenuLineType.Enabled:=True;
MenuLineWidth.Enabled:=True;
MenuPointStyle.Enabled:=True;
SelectedSeries:=Series;//my selected series //SelectedSeries:TChartSeries; I have declared in public
end;
end;

Best Regard
hexfhhu

Posted: Wed Dec 13, 2006 2:02 pm
by narcis
Hi hexfhhu,

With the code you posted you may not be able to do that because you need to type cast the series variable, for example:

Code: Select all

(SelectedSeries as TLineSeries).LinePen.Width:=3;

Posted: Wed Dec 13, 2006 3:00 pm
by 9348298
When I pressed the popmenu Item such as ' color ' , I add code

procedure TFormShowLinebak.MenuLineColorClick(Sender: TObject);
begin
ButtonPen1.LinkPen(SelectedSeries.Pen);
// ButtonPen1: TButtonPen; declared in public
ButtonPen1.OnClick(Sender);
end;

but I can not get the result as pressed ButtonPen1

Posted: Wed Dec 13, 2006 3:03 pm
by narcis
Hi hexfhhu,

Which is the type of the series you are using. If it's a line series you need to use LinePen instead of Pen property. To achieve that you'll need to type cast SelectedSeries as I told you before.

Posted: Thu Dec 14, 2006 2:00 am
by 9348298
Hi Narcís

Ok,I see!
thank you


Best Regards
hexfhhu