Multiple .tee plots on one Chart

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
superviper
Newbie
Newbie
Posts: 7
Joined: Tue Apr 18, 2017 12:00 am

Multiple .tee plots on one Chart

Post by superviper » Sun Apr 23, 2017 8:42 pm

I'm collecting and saving Charts in .tee files. From time to time I need to have options to compare 2 .tee save charts to see difference between measurements.
To make this I would like to open one .tee file (already thanks to forum support I have mange this) and ten I would like to add second one .tee file to the Chart.
I will be appriciated for help to find right methodology how to realize that :)

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

Re: Multiple .tee plots on one Chart

Post by Yeray » Wed Apr 26, 2017 10:30 am

Hello,

A tee file is basically a Chart. What result would you expect when adding/loading a second tee file to a chart?
The properties in the second chart could override those set with the first tee file.
Also, there could be objects (series or tools) in the second tee file already defined in the chart and that would give problems.
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

superviper
Newbie
Newbie
Posts: 7
Joined: Tue Apr 18, 2017 12:00 am

Re: Multiple .tee plots on one Chart

Post by superviper » Tue May 02, 2017 5:35 pm

lets explain. I measure temperature each day. Each day is saved on different .tee file.
After some time there is necessary to visually compare 2 charts (for example day 6 and 8).
No database is possible. Only .tee files.

Do you have any idea how to plot 2 .tee files on 1 chart?

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

Re: Multiple .tee plots on one Chart

Post by Yeray » Wed May 03, 2017 7:59 am

Hello,

Knowing what you have and what you want to get from the charts stored in your tee files, you can:
- Load the first tee file into the final chart
- Load the second tee file into a dummy temporal chart
- Clone series or tools from the dummy chart to the final chart.

Ie, here I use 3 charts. The first two are to generate the tee files, the third is the destination chart I use to load the two tee files into:

Code: Select all

uses Series, TeeStore;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
    tmpChart: TChart;
    oldX, oldY, oldW, oldH: Integer;
const temp1: array[0..23] of Integer = (9, 9, 8, 8, 7, 6, 6, 4, 7, 11, 13, 15, 16, 16, 17, 17, 15, 14, 14, 14, 14, 13, 11, 10);
      temp2: array[0..23] of Integer = (8, 7, 6, 6, 6, 6, 6, 5, 7, 9, 13, 14, 18, 20, 21, 20, 19, 18, 17, 16, 15, 13, 12, 12);
      fileName1='E:\tmp\Temp_01052017.tee';
      fileName2='E:\tmp\Temp_02052017.tee';
begin
  Chart1.Legend.Visible:=False;
  Chart1.View3D:=false;
  with Chart1.AddSeries(TLineSeries) as TLineSeries do
  begin
    Pointer.Visible:=True;
    for i:=0 to High(temp1) do
        AddXY(i, temp1[i]);
  end;
  Chart1.Title.Text.Text:='01/05/2017';

  Chart2.Legend.Visible:=False;
  Chart2.View3D:=false;
  with Chart2.AddSeries(TLineSeries) as TLineSeries do
  begin
    Pointer.Visible:=True;
    for i:=0 to High(temp2) do
        AddXY(i, temp2[i]);
  end;
  Chart2.Title.Text.Text:='02/05/2017';

  SaveChartToFile(Chart1, fileName1);
  SaveChartToFile(Chart2, fileName2);

  //Load Charts
  RegisterTeeStandardSeries;

  oldX:=Chart3.Left;
  oldY:=Chart3.Top;
  oldW:=Chart3.Width;
  oldH:=Chart3.Height;

  LoadChartFromFile(Chart3, fileName1);

  Chart3.Left:=oldX;
  Chart3.Top:=oldY;
  Chart3.Width:=oldW;
  Chart3.Height:=oldH;

  tmpChart:=TChart.Create(Self);
  LoadChartFromFile(tmpChart, fileName2);

  CloneChartSeries(tmpChart[0], Chart3);

  Chart3[0].Title:=Chart3.Title.Text.Text;
  Chart3[1].Title:=tmpChart.Title.Text.Text;
  Chart3.Legend.Visible:=True;
  Chart3.Title.Text[0]:=Chart3.Title.Text[0] + ' vs ' + tmpChart.Title.Text[0];
  Chart3[0].Color:=OperaPalette[1];
  Chart3[1].Color:=OperaPalette[2];

  FreeAndNil(tmpChart);
end;
Project2_2017-05-03_10-00-39.png
Project2_2017-05-03_10-00-39.png (38.31 KiB) Viewed 10897 times
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

superviper
Newbie
Newbie
Posts: 7
Joined: Tue Apr 18, 2017 12:00 am

Re: Multiple .tee plots on one Chart

Post by superviper » Fri May 12, 2017 12:56 pm

Thank you for great explanation :)
I have one more problem

Code: Select all

LoadChartFromFile(TmpChart,
	SDIAppForm->ListView3->Items->Item[SDIAppForm->ListView3->Selected->Index]->Caption
	);

CloneChartSeries(TmpChart[0], SDIAppForm->Chart6);
I'm getting Error:
[bcc32 Error] SDIMAIN.CPP(1682): E2285 Could not find a match for 'CloneChartSeries(TChart,TChart *)'


Below libraries are declared

Code: Select all

#include <VCLTee.Chart.hpp>
#include <VclTee.TeeGDIPlus.hpp>
#include <VCLTee.TeEngine.hpp>
#include <VCLTee.TeeProcs.hpp>
#include <VCLTee.Series.hpp>
#include <VCLTee.DBChart.hpp>
#include <VCLTee.TeeDBCrossTab.hpp>
#include <Vcl.CheckLst.hpp>
#include <VCLTee.TeeData.hpp>
#include "VCLTee.TeeSeriesTextEd.hpp"
#include <VCLTee.TeeURL.hpp>
#include <VCLTee.Teestore.hpp>


How to solve this issue?

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

Re: Multiple .tee plots on one Chart

Post by Yeray » Fri May 12, 2017 2:22 pm

Hello,

Indeed, it's a bit different in CBuilder:

Code: Select all

  double temp1[24] = {9, 9, 8, 8, 7, 6, 6, 4, 7, 11, 13, 15, 16, 16, 17, 17, 15, 14, 14, 14, 14, 13, 11, 10};
  double temp2[24] = {8, 7, 6, 6, 6, 6, 6, 5, 7, 9, 13, 14, 18, 20, 21, 20, 19, 18, 17, 16, 15, 13, 12, 12};
  AnsiString fileName1 = "E:\\tmp\\Temp_01052017.tee";
  AnsiString fileName2 = "E:\\tmp\\Temp_02052017.tee";

  Chart1->Legend->Visible=False;
  Chart1->View3D=false;
  Chart1->AddSeries(new TLineSeries(this));
  dynamic_cast <TLineSeries*>(Chart1->SeriesList->Items[0])->Pointer->Visible=True;

  for (int i=0; i<24; i++)
	Chart1->SeriesList->Items[0]->AddXY(i, temp1[i]);

  Chart1->Title->Text->Text="01/05/2017";

  Chart2->Legend->Visible=False;
  Chart2->View3D=false;
  Chart2->AddSeries(new TLineSeries(this));
  dynamic_cast <TLineSeries*>(Chart2->SeriesList->Items[0])->Pointer->Visible=True;
  for (int i=0; i<24; i++)
	Chart2->SeriesList->Items[0]->AddXY(i, temp2[i]);

  Chart2->Title->Text->Text="02/05/2017";

  SaveChartToFile(Chart1, fileName1);
  SaveChartToFile(Chart2, fileName2);

  //Load Charts
  RegisterTeeStandardSeries();

  int oldX=Chart3->Left;
  int oldY=Chart3->Top;
  int oldW=Chart3->Width;
  int oldH=Chart3->Height;

  LoadChartFromFile(Chart3, fileName1);

  Chart3->Left=oldX;
  Chart3->Top=oldY;
  Chart3->Width=oldW;
  Chart3->Height=oldH;

  TChart *tmpChart = new TChart(this);
  LoadChartFromFile(tmpChart, fileName2);

  Chart3->AddSeries(CloneChartSeries(tmpChart->SeriesList->Items[0]));

  Chart3->SeriesList->Items[0]->Title=Chart3->Title->Text->Text;
  Chart3->SeriesList->Items[1]->Title=tmpChart->Title->Text->Text;
  Chart3->Legend->Visible=True;
  Chart3->Title->Text->Text=Chart3->Title->Text->operator [](0) + " vs " + tmpChart->Title->Text->operator [](0);
  Chart3->SeriesList->Items[0]->Color=OperaPalette[1];
  Chart3->SeriesList->Items[1]->Color=OperaPalette[2];
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

superviper
Newbie
Newbie
Posts: 7
Joined: Tue Apr 18, 2017 12:00 am

Re: Multiple .tee plots on one Chart

Post by superviper » Sat May 13, 2017 3:04 pm

Thank you for really clear and fruitfull answer.

In my case each .tee file have 5 series. Fifth series is dedicated for custom axis. I have finally realize code like this. I hope above support will be helpfull also for others.
Please remember once you will find any problem and find solution please give feedback also for others :) This is how we can help each others :)

Code: Select all

LoadChartFromFile(TmpChart,  File2.tee);

		for (int i = 5; i < 10; i++)
		{
		SDIAppForm->Chart6->AddSeries (new TLineSeries (SDIAppForm->Chart6));
		}


		for (int i = 5; i < 10; i++)
		{
		SDIAppForm->Chart6->Series[i]->Assign (TmpChart->Series[i-5]);
		}

       Chart6->Series[9]->CustomVertAxis=Chart6->Series[4]->CustomVertAxis;   // Assigning custom axis to new series :)


Post Reply