How to save data from a chart.

Hello,

I want to save the YValues from a chart?

If you want to save a StringList, you can do it like this:
StringList.SaveToFile(SaveDialog1.FileName);

But this does not work when the data should be saved directly from the chart:
Chart1.SeriesList.Series[0].YValues.SaveToFile(SaveDialog1.FileName);

Then I get the message: undeclared identifier 'SaveToFile'.
What is the solution?

Thanks in advance.

Comments

  • [b][red]This message was edited by zibadian at 2004-8-8 9:3:25[/red][/b][hr]
    : Hello,
    :
    : I want to save the YValues from a chart?
    :
    : If you want to save a StringList, you can do it like this:
    : StringList.SaveToFile(SaveDialog1.FileName);
    :
    : But this does not work when the data should be saved directly from the chart:
    : Chart1.SeriesList.Series[0].YValues.SaveToFile(SaveDialog1.FileName);
    :
    : Then I get the message: undeclared identifier 'SaveToFile'.
    : What is the solution?
    :
    : Thanks in advance.
    :
    YOu can always copy the values into a TStringList and save that. The code for it is'nt to difficult to write. Or you can use a simple textfile and write the values directly to the disk.

  • : [b][red]This message was edited by zibadian at 2004-8-8 9:3:25[/red][/b][hr]
    : : Hello,
    : :
    : : I want to save the YValues from a chart?
    : :
    : : If you want to save a StringList, you can do it like this:
    : : StringList.SaveToFile(SaveDialog1.FileName);
    : :
    : : But this does not work when the data should be saved directly from the chart:
    : : Chart1.SeriesList.Series[0].YValues.SaveToFile(SaveDialog1.FileName);
    : :
    : : Then I get the message: undeclared identifier 'SaveToFile'.
    : : What is the solution?
    : :
    : : Thanks in advance.
    : :
    : YOu can always copy the values into a TStringList and save that. The code for it is'nt to difficult to write. Or you can use a simple textfile and write the values directly to the disk.
    :
    : Actually I would like to save the data as a text file (.txt). Is it necesarry to copy it to a StringList first? And how do I do that.

    Regards

  • : : [b][red]This message was edited by zibadian at 2004-8-8 9:3:25[/red][/b][hr]
    : : : Hello,
    : : :
    : : : I want to save the YValues from a chart?
    : : :
    : : : If you want to save a StringList, you can do it like this:
    : : : StringList.SaveToFile(SaveDialog1.FileName);
    : : :
    : : : But this does not work when the data should be saved directly from the chart:
    : : : Chart1.SeriesList.Series[0].YValues.SaveToFile(SaveDialog1.FileName);
    : : :
    : : : Then I get the message: undeclared identifier 'SaveToFile'.
    : : : What is the solution?
    : : :
    : : : Thanks in advance.
    : : :
    : : YOu can always copy the values into a TStringList and save that. The code for it is'nt to difficult to write. Or you can use a simple textfile and write the values directly to the disk.
    : :
    : : Actually I would like to save the data as a text file (.txt). Is it necesarry to copy it to a StringList first? And how do I do that.
    :
    : Regards
    :
    :
    This kind of stuff is actually very basic. Here is a sample code to save the values using a simple textfile variable. It is somewhat faster than first transfering the values into a stringlist.
    [code]
    var
    f: textfile;
    i: integer;
    begin
    AssignFile(f, 'filename.txt');
    Rewrite(f);
    for i := 0 to Chart1.Series[0].YValues.Count-1 do
    writeln(f, Chart1.Series[0].YValues.Value[i]);
    CloseFile(f);
    end;
    [/code]
    More info on this can be found in the help files.
  • Allright, I will try that, and then get back later.
    Thank you very much!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories