Christos Hayward
Christos Hayward

Reputation: 5993

Can I export FusionCharts data to a CSV file, saved as text/csv (or other graceful solution)?

Right now, FusionCharts 3.1 Flash charts provide a context menu that, if you configure it appropriately, will allow the user to save the data as a JPG / PNG / PDF file. The same menu also allows CSV data to be copied to clipboard.

Excel 2010 does not handle pasted CSV as one might wish here: it pastes into one line per cell without separating on commas. You can, with a song and dance, have the CSV interpreted: click on Data, then Text to Columns, then Delimited and Next, then uncheck Tab and check Comma as separator, and then Finish (English translation: "Please call our help desk!"). This is really a few steps too many for usability concerns.

One could imagine a slightly shorter song and dance (perhaps open up Notepad, paste, and save with a .csv extension), but I would ideally like people to run on a mental model of "I save the data, open it with Excel, and see the data naturally."

Is there a way to let FusionCharts export CSV as text/csv so there is no song and dance required of the end user beyond "Save the data and open it in Excel"?

Upvotes: 0

Views: 3165

Answers (2)

sudipto
sudipto

Reputation: 2482

Could you please try once setting exportDataSeparator='{tab}' in <chart> and try again? My Excel in mac seems to respond well using this.

I have used this XML and right clicked on chart to copy data to clip-board and pasted in excel:

<chart exportDataSeparator='{tab}' showExportDataMenuItem='1'caption='Weekly Sales Summary'  xAxisName='Week' yAxisName='Sales' numberPrefix='$' >
    <categories>
        <category label='Dec'/>
        <category label='Jan'/>
        <category label='Feb'/>
        <category label='Mar'/>
        <category label='Apr'/>
        <category label='May'/>

    </categories>

    <dataset seriesName='current'>
        <set value='123123' />
        <set value='123123' />
        <set value='123123' />
        <set value='123123' />
        <set value='123123' />
        <set value='123123' />
    </dataset>
    <dataset seriesName='2010'>
        <set value='123123' />
        <set value='123123' />
        <set value='123123' />
        <set value='123123' />
        <set value='123123' />
        <set value='123123' />
    </dataset>
</chart>

My excel in mac shows this: Excel-mac puts csv values in proper cells when separator is set to tab

And so is my windows Excel 2010:

In Excel 2010 Windws it works too

Upvotes: 4

Femi
Femi

Reputation: 64700

Not natively, but you can use the javascript API to copy it to a Javascript variable (see http://www.fusioncharts.com/docs/ExportDataJS.html) and then use Downloadify or HTML5 data uris to generate a save file dialog (as covered here Using HTML5/Javascript to generate and save a file).

Let me know if that works: kinda interesting, didn't realize this was running around.

Upvotes: 2

Related Questions