Page 1 of 1

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

Posted: Thu Sep 18, 2014 11:47 am
by 16469977
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

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

Posted: Thu Sep 18, 2014 12:19 pm
by yeray
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;

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

Posted: Thu Sep 18, 2014 2:47 pm
by 16469977
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.

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

Posted: Fri Sep 19, 2014 3:00 pm
by yeray
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;