How to remove button from Highcharts

前端 未结 8 623
北荒
北荒 2021-02-02 04:42

I\'m creating charts with the Highcharts library and I wonder how to remove the 2 little buttons on the right corner which one you can print and download graphs and I\'d like to

8条回答
  •  日久生厌
    2021-02-02 05:39

    The best way to replace the hamburger icon is to disable the navigation buttonOptions, then create your own menu and customize the context one by one as stated in the documentation. From here you can use any icon you want with your own dropdown menu.

    This disables the hamburger icon.

    navigation: {
    buttonOptions: {
      enabled: false
      }
     }
    

    This is how you customize export options for your own list.

    $('#print').click(function() {
    chart.print();
    });
    $('#pdf').click(function() {
    chart.exportChart({
      type: 'application/pdf',
      filename: 'my-pdf'
     });
    });
    $('#png').click(function() {
    chart.exportChart({
      type: 'image/png',
      filename: 'my-png'
     });
    });
    $('#jpeg').click(function() {
    chart.exportChart({
      type: 'image/jpeg',
      filename: 'my-jpeg'
     });
    });
    $('#svg').click(function() {
    chart.exportChart({
      type: 'image/svg+xml',
      filename: 'my-svg'
     });
    });
    

    jsfiddle

提交回复
热议问题