score:0

import react from 'react';
import highchartsreact from 'highcharts-react-official';
import highcharts from 'highcharts/highcharts';
import exporting from 'highcharts/modules/exporting';
exporting(highcharts)

class chart extends component {

  componentdidmount() {
    console.log(this.refs[chartref].getsvg());
  }

  render() {
    return (
      <highchartsreact
         highcharts={highcharts}
         options={...youroptions}
         ref="chartref"
      />);
   }
}

export default chart;

here you can access getsvg. just include exporting(highcharts)

score:1

follow the below codes to implement in yours:

const reacthighcharts = require('react-highcharts');

class mycomponent extends react.component {
  componentdidmount() {
    let chart = this.refs.chart.getchart();
    let svg = chart.getsvg(); // this is your svg
  }

  render() {
    return <reacthighcharts config={config} ref="chart"/>;
  }
}

if the above code under componentdidmount() didn't work, then try this code:

componentdidupdate() {
    if (this.refs.chart) {
        let chart = this.refs.chart.refs.chart;
        let html = document.createelement('html');
        html.innerhtml = chart.innerhtml;
        let svg = html.getelementsbytagname('svg')[0].outerhtml; // this is your svg
    }
}

Related Query

More Query from same tag