Page 1 of 1

About the method of "SaveChartToFile" and "Lo

Posted: Thu Nov 20, 2008 8:10 am
by 8574101
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");
}

Posted: Thu Nov 20, 2008 8:21 am
by 8574101
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"

Posted: Thu Nov 20, 2008 8:40 am
by 8574101
Maybe I should use the following codes to add points

Code: Select all

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

Posted: Thu Nov 20, 2008 9:02 am
by narcis
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!