Add options like add/delete/modifySeries in modal dialog box

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
skng
Newbie
Newbie
Posts: 7
Joined: Thu Aug 07, 2014 12:00 am

Add options like add/delete/modifySeries in modal dialog box

Post by skng » Thu Sep 18, 2014 11:47 am

Hi,

I have to implement a custom modal dialog box to add/delete/modify the Series (along with other additional options, which are related to the project). Currently, TeeChart provides TChartEditor to edit the chart. I don't need all the options, which are provided in TChartEditor.

Could you please tell me how to implement options like add/delete/modify the Series in my custom modal dialog box ?

thanks in advance

Yeray
Site Admin
Site Admin
Posts: 9533
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Add options like add/delete/modifySeries in modal dialog box

Post by Yeray » Thu Sep 18, 2014 12:19 pm

Hello,

Here you have the code we use for the Add/Remove/Change buttons in our editor:

Code: Select all

procedure TChartEditForm.BAddSeriesClick(Sender: TObject);
var tmpSeries : TChartSeries;
    tmpGroup  : TSeriesGroup;
begin
  TabSeries.Parent:=MainPage;

  tmpSeries:=LBSeries.AddSeriesGallery;

  if Assigned(tmpSeries) then
  begin
    tmpGroup:=CurrentGroup;

    if Assigned(tmpGroup) then
    begin
      tmpGroup.Add(tmpSeries);
      LBSeries.UpdateSeries;
    end;
  end;

  if Assigned(tmpSeries) and Assigned(tmpSeries.FunctionType) then
  begin
    TheSeries:=tmpSeries;
    MainPage.ActivePage:=TabSeries;
    SetTabSeries;
    
    With TheFormSeries do
    begin
      PageSeries.ActivePage:=TabDataSource;
      PageSeriesChange(Self);
      CBDataSourcestyleChange(Self);
    end;
  end;

  TrySetFocus(LBSeries);
end;

Code: Select all

procedure TChartEditForm.BDeleteSeriesClick(Sender: TObject);
begin
  TabSeries.Parent:=MainPage;
  LBSeries.DeleteSeries;

  if Assigned(TheFormSeries) then
  begin
    TheFormSeries.TheSeries:=nil;
    InternalSetupFormSeries;
  end;
end;

Code: Select all

procedure TChartEditForm.BChangeTypeSeriesClick(Sender: TObject);
begin
  LBSeries.ChangeTypeSeries(Self);
  if Assigned(TheFormSeries) then InternalSetupFormSeries;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

skng
Newbie
Newbie
Posts: 7
Joined: Thu Aug 07, 2014 12:00 am

Re: Add options like add/delete/modifySeries in modal dialog box

Post by skng » Thu Sep 18, 2014 2:47 pm

Yerray,

thanks for your reply.

I am not good at Delphi and my project is in VCL C++.
I am trying to understand your code and if possible please clear the below query.

what are the types of TabSeries, MainPage, TheSeries, SetTabSeries, TheFormSeries, PageSeries, TabDataSource, PageSeriesChange(Self) in your code ?

Question related to TChartListBox:
Is it possible to show the series information in multiple columns (I only use line/fast line type series.) ?
For example: [stairs or normal line type image] [series name] [units of the series data] instead of [series type image] [series title]

How to add name of the series?

Once again thanks for your reply and looking forward to hear from you.

Yeray
Site Admin
Site Admin
Posts: 9533
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Add options like add/delete/modifySeries in modal dialog box

Post by Yeray » Fri Sep 19, 2014 3:00 pm

Hi,
skng wrote:what are the types of TabSeries, MainPage, TheSeries, SetTabSeries, TheFormSeries, PageSeries, TabDataSource, PageSeriesChange(Self) in your code ?
TabSeries is a TTabSheet, the "Series" tab in the editor.
MainPage is the TPageControl that contains all the tabs like TabSeries.
TheSeries is a TChartSeries used to store the series that is selected to know it in case you want to move to the series tab.
SetTabSeries is a method we use to change to the series tab when a series has been created.
TheFormSeries is a TFormTeeSeries, the series editor.
PageSeries is a TPageControl in TFormTeeSeries where the "Format", "General", "Marks" and "Data Source" tabs are placed.
TabDataSource is a TTabSheet, the "DataSource" tab in the series editor.
PageSeriesChange() is a method in TFormTeeSeries used to change to the tab PageSeries property indicates.
skng wrote:Question related to TChartListBox:
Is it possible to show the series information in multiple columns (I only use line/fast line type series.) ?
For example: [stairs or normal line type image] [series name] [units of the series data] instead of [series type image] [series title]
You can make visible/invisible some columns with the ShowSeriesIcon, ShowSeriesColor, ShowActiveCheck, ShowSeriesTitle properties, but I'm afraid you can't add new columns to the TChartListBox.
Actually, you could inherit TChartListBox creating your own derived ListBox.
skng wrote:How to add name of the series?
You can use the TChartSeries' Title property. Ie:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  for i:=0 to 2 do
    with Chart1.AddSeries(TBarSeries) as TBarSeries do
    begin
      FillSampleValues();
      Title:='MySeries ' + IntToStr(i);
    end;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply