ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Saving the png generated file in a preffered directory.
Posted by Robert on Dec-26-2007 05:30
Hi everyone!

I have a little program that picks a High/low data text file from a directory with the usual File --> Open interface.

PNG generated files are done as follow in ChartDirector:
//Generates the chart image and save it into a file.
   c.makeChart("MyChart.png");
and usually the generated png file ends into a determinate folder (usually in the Project or the Distribution folder).

Would you be nice enough to tell me how I can modify the
c.makeChart("MyChart.png");
code to have the drawn chart saved into the directory where I picked up the text file.

Thanks in advance and all my good wishes for the next year.

Robert

  Re: Saving the png generated file in a preffered directory.
Posted by Peter Kwan on Dec-26-2007 15:52
Hi Robert,

You need to know which is the directory that you pick up your text file. ChartDirector cannot know which directory your text file is located.

Suppose the variable xxx represents the directory that you text file is located, then you just use that directory in the file path when saving the image file.

  c.makeChart(xxx + "/MyChart.png");

Hope this can help.

Regards
Peter Kwan

  Re: Saving the png generated file in a preffered directory.
Posted by Alex Zeng on Jul-31-2009 00:19
Peter,

I'm using Perl ChartDirector, and I'm curious if it's possible to have ChartDirector create a
brand new folder, named after a user input, in my working directory?

For example, my script will get data from a source, use ChartDirector to make a graph out
of it, and prompt the user: "Please enter your initials: "
The user enters the initials, hits enter. The script then creates a folder named after the
initials, and saves the graph into that new folder.

Alex

  Re: Saving the png generated file in a preffered directory.
Posted by Peter Kwan on Jul-31-2009 01:00
Hi Alex,

Yes. ChartDirector can save the chart in any directory you like. The API is BaseChart.makeChart. You just need to pass the full path you want to save the chart as the argument to BaseChart.makeChart. Your code would need to ensure the directory exists and is writable by your script.

Hope this can help.

Regards
Peter Kwan