【问题标题】:How to Get element properties from Highchart如何从 Highchart 中获取元素属性
【发布时间】:2015-10-06 05:12:05
【问题描述】:
function MyCtrl($scope, limitToFilter) {
Highcharts.setOptions({
     colors: ['#B1D08C', '#B1D08C', '#B1D08C']
    });

$scope.ideas = [
    ['Development', 70],
    ['Exploration', 5],
    ['Other', 10],
    ['ideas4', 5]
  ];


$scope.limitedIdeas = limitToFilter($scope.ideas, 3);

}

angular.module('myApp', [])
  .directive('hcPie', function () {
  return {
    restrict: 'C',
    replace: true,
    scope: {
      items: '='
    },
controller: function ($scope, $element, $attrs) {
      console.log(4);

    },
template: '<div id="container" style="margin: 0 auto">not working</div>',
    link: function (scope, element, attrs) {
      console.log(3);
var chart = new Highcharts.Chart({


 subtitle: {
            text: '$2567 mm',
            align: 'center',
            verticalAlign: 'middle',
            y: 40,
            useHTML: true
        },

chart: {
          renderTo: 'container',
          plotBackgroundColor: null,
          plotBorderWidth: null,
          plotShadow: false,           
          type: 'pie'
        },
        title: {
          text: 'CAPITAL (DEVON) E&P CAPEX'
        },
        tooltip: {
          //pointFormat: '{series.name}: <b>{point.percentage}</b>',
          //percentageDecimals: 1
        },

plotOptions: {
        pie: {
                borderColor: '#fff',
                innerSize: '60%',

            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: {
              enabled: true,
              color: '#000000',
              connectorColor: '#000',
              /*formatter: function () {
                return '<b>' + this.point.name + '</b>: ' + this.percentage;
              }*/
            }
}
},

series: [{
          type: 'pie',
          name: 'Browser share',
          data: scope.items
        }]
      });


scope.$watch("items", function (newValue) {
        chart.series[0].setData(newValue, true);
      }, true);

    }
  }

});

我正在尝试创建一个带圆圈的圆点图。有没有在图表中心创建圆圈的选项?如何通过jquery获取&lt;g class="highcharts-series-group"&gt;等highchart SVG元素的属性(位置或宽度)

https://jsfiddle.net/id10922606/81cwutyf/1/

【问题讨论】:

    标签: javascript jquery svg highcharts


    【解决方案1】:

    对于这个问题:

    subtitle: {
            text: '$2567 mm',
            align: 'center',
            verticalAlign: 'middle',
            y: 0,
            useHTML: true
        }
    

    fiddle here

    【讨论】:

    • 不是这样。如何将以下代码添加到我的 highchart 代码中? function (chart) { // 完成 var xpos = '50%'; var ypos = '64%';变圆半径= 50; // 渲染圆 circle = chart.renderer.circle(xpos, ypos, circleradius).attr({ fill: '#7EBA00', }).add(); });
    • 在你的图表加载事件中添加这个,chart:{ events: {load: function (){ // 你的代码在这里 });
    猜你喜欢
    • 1970-01-01
    • 2015-07-31
    • 1970-01-01
    • 2017-09-24
    • 2021-09-09
    • 1970-01-01
    • 2012-01-20
    • 1970-01-01
    相关资源
    最近更新 更多