gpt4 book ai didi

javascript - 如何从 Highchart 获取元素属性

转载 作者:行者123 更新时间:2023-11-28 06:51:01 24 4
gpt4 key购买 nike

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);

}
}

});

我正在尝试创建一个带有圆圈的圆图。是否有任何选项可以在图表中心创建圆圈?如何获取 highchart SVG 元素的属性(位置或宽度),例如 <g class="highcharts-series-group">通过 jquery

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

最佳答案

对于这个问题:

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

参见fiddle here

关于javascript - 如何从 Highchart 获取元素属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32962166/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com