微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javascript-HighCharts:如何从图表容器中添加或删除“图表上下文菜单”?

highcharts中是否有任何属性可用于删除图表上下文菜单(该属性看起来像右侧的汉堡菜单)使用JavaScriptthis柱形图中显示

认情况下,此选项是否出现在highchart中?我也有一个折线图,但是在认情况下,没有一个折线图菜单.另外,如果我想向该折线图添加图表上下文菜单,该怎么做?

Highcharts.chart('container',{
  chart: {
    type: 'column',events: {
      load: function() {
        var series = this.series[0];
        setInterval(function() {
          newValue = Math.random() * 100;
          series.update({
            data: [newValue],},true)
        },1000);
      }
    }
  },title: {
    text: 'Monthly Average Rainfall'
  },subtitle: {
    text: 'Source: Worldclimate.com'
  },xAxis: {
    categories: [
      'Jan'
    ],crosshair: true
  },yAxis: {
    min: 0,title: {
      text: 'Rainfall (mm)'
    }
  },tooltip: {
    headerFormat: '<span style="font-size:10px">{point.key}</span><table>',pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
      '<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',footerFormat: '</table>',shared: true,useHTML: true
  },plotOptions: {
    column: {
      pointPadding: 0.2,borderWidth: 0
    }
  },series: [{
    name: 'Tokyo',data: [49.9]

  },{
    name: 'New York',data: [83.6]

  },{
    name: 'London',data: [48.9]

  },{
    name: 'Berlin',data: [42.4]

  }]
});
最佳答案
只需包含< script src =“ https://code.highcharts.com/modules/exporting.js”>< / script>

您可以通过添加buttonOptions启用或禁用它.认值为true

Highcharts.chart('container',{
    navigation: {
        buttonoptions: {
            enabled: true
        }
    }
});
Highcharts.chart('container',data: [42.4]

  }]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>

<div id="container" style="height: 400px; margin-top: 1em"></div>

原文地址:https://www.jb51.cc/js/531228.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐