【问题标题】:Highcharts in Yii2Yii2中的Highcharts
【发布时间】:2017-04-27 01:56:37
【问题描述】:

你知道这个在 Yii2 中的源代码位置吗?我已经通过 composer 安装了 highcharts。

因为我想在上面添加一个列表。提前致谢

【问题讨论】:

  • 你想在列表中添加另一个选项
  • 是的,我想添加另一个选项@Deep3015

标签: highcharts yii2


【解决方案1】:

查看vendor目录。

因此,如果您使用“miloschuman\yii2-highcharts-widget”并使用 composer 安装它,请尝试查看 vendor\miloschuman\yii2- highcharts-widget 目录。

与“yiisoft\yii2”等其他供应商也是如此,它们也在 vendor 目录中。

另一个建议。如果您打算在供应商目录中修改这些源代码,请不要这样做。这是不可取的,因为当您运行另一个 composer update 时,您对该源代码所做的所有更改都将被覆盖。只需 fork 那个包并创建你自己的包,这样它就不会在你运行 composer update 后被覆盖。

【讨论】:

    【解决方案2】:

    更多详情请看这里Exporting Buttons

    $(function() {
      $('#container').highcharts({
    
        title: {
          text: 'Solar Employment Growth by Sector, 2010-2016'
        },
    
        subtitle: {
          text: 'Source: thesolarfoundation.com'
        },
    
        yAxis: {
          title: {
            text: 'Number of Employees'
          }
        },
        legend: {
          layout: 'vertical',
          align: 'right',
          verticalAlign: 'middle'
        },
    
        plotOptions: {
          series: {
            pointStart: 2010
          }
        },
    
        series: [{
          name: 'Installation',
          data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
        }, {
          name: 'Manufacturing',
          data: [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434]
        }, {
          name: 'Sales & Distribution',
          data: [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387]
        }, {
          name: 'Project Development',
          data: [null, null, 7988, 12169, 15112, 22452, 34400, 34227]
        }, {
          name: 'Other',
          data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111]
        }]
      });
    
    
      Highcharts.getOptions().exporting.buttons.contextButton.menuItems.push({
        text: 'Additional Button',
        onclick: function() {
          alert('OK');
          /*call custom function here*/
        }
      });
    
    
    });
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="http://code.highcharts.com/highcharts.js"></script>
    <script src="http://code.highcharts.com/modules/exporting.js"></script>
    
    <div id="container" style="height: 400px; margin-top: 1em"></div>

    【讨论】:

    • @r34627673 通过您无法获得的程序
    猜你喜欢
    • 1970-01-01
    • 2020-07-25
    • 1970-01-01
    • 1970-01-01
    • 2013-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多