highcharts / export-csv

Highcharts plugin to export chart data to CSV
http://www.highcharts.com/plugin-registry/single/7/Export-CSV
MIT License
76 stars 95 forks source link

[question] Is there a way to hide specific keys from a priceline series from the CSV? #120

Closed leongaban closed 7 years ago

leongaban commented 7 years ago

http://stackoverflow.com/questions/41902662/how-to-reformat-a-highchart-series-keys-array-to-display-only-1-column-in-the-cs

1st

It's not a series I'm trying to remove/hide, but specific keys, in this case x and end

priceLine series options:

options

priceLine series data:

data

leongaban commented 7 years ago

Figured it out:

### Finally figured it out!

Had to remove the line where I set the series to a `var`

    const updatePriceLine = (chart) => {
        // const priceLine = chart.get('series-priceline');
        const prices = chart.get('series-priceline').data.map((point) => {
            return {
                x: point.x,
                y: point.y
            };
        });

        chart.get('series-priceline').update({ keys: ['y'] });
        chart.get('series-priceline').setData(prices)
        return chart;
    };

So just called the `.update` and `.setData` directly on the `chart.get('series-priceline')`