Angularjs 如何使用angular JS创建圆环形海图
我想用angular js创建一个甜甜圈海图 javascript是-Angularjs 如何使用angular JS创建圆环形海图,angularjs,highcharts,Angularjs,Highcharts,我想用angular js创建一个甜甜圈海图 javascript是- $(function () { $('#container').highcharts({ chart: { plotBackgroundColor: null, plotBorderWidth: 0, plotShadow: false }, title: { text: '
$(function () {
$('#container').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: 0,
plotShadow: false
},
title: {
text: 'Browser<br>shares<br>2015',
align: 'center',
verticalAlign: 'middle',
y: 40
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
dataLabels: {
enabled: true,
distance: -50,
style: {
fontWeight: 'bold',
color: 'white',
textShadow: '0px 1px 2px black'
}
},
startAngle: -180,
endAngle: 180,
center: ['50%', '55%']
}
},
series: [{
type: 'pie',
name: 'Browser share',
innerSize: '50%',
data: [
['Firefox', 10.38],
['IE', 56.33],
['Chrome', 24.03],
['Safari', 4.77],
['Opera', 0.91],
{
name: 'Proprietary or Undetectable',
y: 0.9,
dataLabels: {
enabled: false
}
}
]
}]
});
});
$(函数(){
$(“#容器”)。高图({
图表:{
plotBackgroundColor:null,
绘图边框宽度:0,
plotShadow:false
},
标题:{
文本:“浏览器
共享
2015”,
对齐:'居中',
垂直排列:'中间',
y:40
},
工具提示:{
pointFormat:“{series.name}:{point.percentage:.1f}%”
},
打印选项:{
馅饼:{
数据标签:{
启用:对,
距离:-50,
风格:{
fontWeight:'粗体',
颜色:'白色',
textShadow:'0px 1px 2px黑色'
}
},
startAngle:-180,
端角:180,
中间:['50%,'55%']
}
},
系列:[{
键入“pie”,
名称:“浏览器共享”,
内部尺寸:“50%”,
数据:[
[Firefox',10.38],
[IE',56.33],
[Chrome',24.03],
[Safari',4.77],
[Opera',0.91],
{
名称:“专有或不可检测”,
y:0.9,
数据标签:{
已启用:false
}
}
]
}]
});
});
html是-
<div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
我包括这些脚本文件-
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
如何在angular js中转换上述脚本。有人能帮我吗?
我认为需要创建一些指令函数。我不熟悉angular中的自定义指令,有人能帮助我们如何在angular中为甜甜圈highchart实现这一点吗?无需在angular中转换highchart,因为它已经存在。不需要注入依赖项。你可以直接使用它。只需注入高位图表 档案
根据需要。在控制器中,直接使用Highcharts.chart({//code goes here})。这是链接如何使用?highcharts ng为我工作。
<script src="script/chart/highcharts.js"></script>
<script src="script/chart/highcharts-more.js"></script>
<script src="script/chart/drilldown.js"></script>
<script src="script/chart/highcharts-3d.js"></script>
<script src="script/chart/exporting.js"></script>