我是靠谱客的博主 沉静水杯,这篇文章主要介绍饼状图(pie chart)示例代码,现在分享给大家,希望可以做个参考。

饼状图

  • 示例
  • 代码
    • HTML
    • CSS
    • JS

更多有趣示例 尽在 知屋安砖社区

示例

在这里插入图片描述

代码

HTML

复制代码
1
2
3
4
5
6
<script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"> <script src="https://code.highcharts.com/modules/accessibility.js"></script></script> <div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>

CSS

复制代码
1
2
3
4
5
6
7
#container { min-width: 310px; max-width: 800px; height: 400px; margin: 0 auto }

JS

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Highcharts.setOptions({ colors: ['#C0C0C0', '#808080', '#0C090A'] }); Highcharts.chart('container', { chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false, type: 'pie' }, title: { text: 'Air Composition' }, tooltip: { pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>' }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: false }, showInLegend: true } }, series: [{ name: 'Composition', colorByPoint: true, data: [{ name: 'Nitrogen', //color: '#01BAF2', y: 78, }, { name: 'Oxygen', //color: '#71BF45', y: 20.9, sliced: true, selected: true }, { name: 'Other gases', //color: '#FAA74B', y: 1.1 }] }] });

最后

以上就是沉静水杯最近收集整理的关于饼状图(pie chart)示例代码的全部内容,更多相关饼状图(pie内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(47)

评论列表共有 0 条评论

立即
投稿
返回
顶部