About the method of "SaveChartToFile" and "Lo

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
wwp3321
Newbie
Newbie
Posts: 60
Joined: Wed Jul 02, 2003 4:00 am

About the method of "SaveChartToFile" and "Lo

Post by wwp3321 » Thu Nov 20, 2008 8:10 am

The following codes don't work well.
I used "LoadChartFromFile()" to load chart settings,and then
add some sample points to chart .But the "Access violation ,read address of 00000000" was showed .

BTW: I used TeeChart6.01,BCB6.0

Code: Select all

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include "TeeStore.hpp"
#include "EditChar.hpp"
#include "TeeEditPRO.hpp"


//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}

//Load Tchart Parameters
void __fastcall TForm1::btnSaveparaClick(TObject *Sender)
{

   SaveChartToFile(Chart1,"d:\\a.tee",false,false);
}

//Edit chart
void __fastcall TForm1::btnEditchartClick(TObject *Sender)
{
    EditChart(Form1,Chart1);
}

//Add sample points
void __fastcall TForm1::btnAddPointClick(TObject *Sender)
{
    Series1->FillSampleValues(100) ;
    Series2->FillSampleValues(100) ;
}

//Load chart Parameters
void __fastcall TForm1::btnLoadParaClick(TObject *Sender)
{
    if(FileExists("d:\\a.tee"))
        LoadChartFromFile(Chart1,"d:\\a.tee");
}

wwp3321
Newbie
Newbie
Posts: 60
Joined: Wed Jul 02, 2003 4:00 am

Post by wwp3321 » Thu Nov 20, 2008 8:21 am

Even I have added "#pragma link "TeeEditPRO",application just showed
same error.

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include "TeeStore.hpp"
#include "EditChar.hpp"
#include "TeeEditPRO.hpp"
#pragma link "TeeEditPRO"

wwp3321
Newbie
Newbie
Posts: 60
Joined: Wed Jul 02, 2003 4:00 am

Post by wwp3321 » Thu Nov 20, 2008 8:40 am

Maybe I should use the following codes to add points

Code: Select all

    Chart1->Series[0]->FillSampleValues(100) ;
    Chart1->Series[1]->FillSampleValues(100) ;

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

Post by Narcís » Thu Nov 20, 2008 9:02 am

wwp3321 wrote:Maybe I should use the following codes to add points

Code: Select all

    Chart1->Series[0]->FillSampleValues(100) ;
    Chart1->Series[1]->FillSampleValues(100) ;
Yes, exactly. Once you have loaded a chart variables like Series1 and Series2 are no longer valid. Imagine you export that chart and import it into an application where those variables don't exist!
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

Post Reply