about chart line style ,width

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
hexfhhu
Newbie
Newbie
Posts: 21
Joined: Thu Dec 07, 2006 12:00 am

about chart line style ,width

Post by hexfhhu » Wed Dec 13, 2006 3:21 am

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?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Dec 13, 2006 8:58 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

hexfhhu
Newbie
Newbie
Posts: 21
Joined: Thu Dec 07, 2006 12:00 am

Post by hexfhhu » Wed Dec 13, 2006 12:48 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Dec 13, 2006 2:02 pm

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;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

hexfhhu
Newbie
Newbie
Posts: 21
Joined: Thu Dec 07, 2006 12:00 am

Post by hexfhhu » Wed Dec 13, 2006 3:00 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Dec 13, 2006 3:03 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

hexfhhu
Newbie
Newbie
Posts: 21
Joined: Thu Dec 07, 2006 12:00 am

Post by hexfhhu » Thu Dec 14, 2006 2:00 am

Hi Narcís

Ok,I see!
thank you


Best Regards
hexfhhu

Post Reply