How to remove button from Highcharts

前端 未结 8 617
北荒
北荒 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:16

    The best way to do this is to update the exporting.buttons.contextButton.menuItems array to only include the menu items you want. Below is an example that excludes the "Print Chart" and "View Full Screen" options.

    exporting: {
        buttons: {
            contextButton: {
                menuItems: ["downloadPNG", "downloadJPEG", "downloadPDF", "downloadSVG"]
            }
        }
    }
    

    Highcharts Example

    0 讨论(0)
  • 2021-02-02 05:19
    exporting: {
        buttons: {
            contextButton: {
                enabled: false
            }
        }
    }
    

    You have to disable only the contextButton.

    0 讨论(0)
  • 2021-02-02 05:21

    Other option is: you can just remove import of "node_modules/highcharts/modules/exporting.js" from the whole project if you don't need it at all.

    That was a solution for me!

    0 讨论(0)
  • 2021-02-02 05:27
    exporting:false,
    

    Add the above code to disable export option.

    0 讨论(0)
  • 2021-02-02 05:32

    @dgw has the right idea to remove the export buttons, but I wasn't happy with the "and I'd like to add a new one" suggestions until I realized I should just make the buttons outside the graph. Unless your data is static, you don't really know if there's room to display your controls.

    <div id="container" style="height: 400px; min-width: 600px"></div>
    <button id="button" class="autocompare">new button</button>
    
    0 讨论(0)
  • 2021-02-02 05:38

    Check this to create new button:

    Example: http://jsfiddle.net/fXHB5/3496/

    exporting: {
        buttons: [
            {
                symbol: 'diamond',
                x: -62,
                symbolFill: '#B5C9DF',
                hoverSymbolFill: '#779ABF',
                _titleKey: 'printButtonTitle',
                onclick: function() {
                    alert('click!')
                }
            }
        ]
    }
    
    0 讨论(0)
提交回复
热议问题