Oscar LT
Oscar LT

Reputation: 797

Save highchart's legend hidden

I save the highchart's graphic as svg.

var chart = $('#graphicName').highcharts();

EXPORT_WIDTH = 1000;

render_width = EXPORT_WIDTH;
render_height = render_width * chart.chartHeight / chart.chartWidth;
var svg = chart.getSVG({
  exporting: {
    sourceWidth: chart.chartWidth,
    sourceHeight: chart.chartHeight
  }
});

Ok, now I would like download the highchart's legend but it should be hidden. I don't know if highcharts has an option to do this.

Thanks any help.

Upvotes: 0

Views: 182

Answers (1)

wergeld
wergeld

Reputation: 14452

This can be done by modifying the chartOptions in your export call:

var chart = $('#graphicName').highcharts();

    EXPORT_WIDTH = 1000;

    render_width = EXPORT_WIDTH;
    render_height = render_width * chart.chartHeight / chart.chartWidth;
    var svg = chart.getSVG({
      exporting: {
        sourceWidth: chart.chartWidth,
        sourceHeight: chart.chartHeight,
        chartOptions: {
            legend: {
                enabled: true
            }
         }
        }
    });

Upvotes: 1

Related Questions