1

In this Highcharts chart the objective is to offline export using a button external to the chart.

The problem that I have is that even thought I added the offline-exporting.js file to my application, if I'm not connected to the Internet when I click the Offline Export button I get an error saying it cannot access the URL export.highcharts.com.

How to fix this error and export offline?

HTML

  <button id="exp" >Offline Export</button>
  <div id="container" style="height: 400px; width: 500px"></div>

Javascript:

var settings =  
        {
         "chart": {
           "type":"line"
        },
       "xAxis": { 
          "endOnTick":true
       },
       "series":[
           {"name":"series1","data":[[1,1200],[2,2200],[3,3200],[4,1800],[5,1500]]},
           {"name":"series2","data":[[1,1050],[2,2050],[3,1650],[4,1450],[5,1350]]},
           {"name":"series3","data":[[1,1250],[2,2250],[3,1850],[4,1650],[5,1550]]}]
       }


    var chart = $('#container').highcharts(settings);


    $( "#exp" ).click(function() {
        alert( "Handler for .click() called." );
        var chart = $('#container').highcharts();
            chart.exportChart({
                type: 'image/png',
                filename: 'theimage'
            });
      });
ps0604
  • 1,227
  • 23
  • 133
  • 330
  • This might be helpful to you. https://stackoverflow.com/questions/25630811/export-highcharts-to-pdf-using-javascript-and-local-server-no-internet-connec. Also, you can refer to below 2 url: (1) https://www.highcharts.com/docs/export-module/client-side-export (2) https://www.highcharts.com/component/content/article/2-news/52-serverside-generated-charts – TechnoCrat Oct 05 '17 at 05:50

1 Answers1

3

Try to using exportChartLocal()

   $( "#exp" ).click(function() {
    alert( "Handler for .click() called." );
    var chart = $('#container').highcharts();
        chart.exportChartLocal({
            type: 'image/png',
            filename: 'theimage'
        });
  });
nmtri
  • 444
  • 3
  • 6