首页 > 其他分享 >Highcharts绘制饼图

Highcharts绘制饼图

时间:2024-05-30 10:21:40浏览次数:14  
标签:name true data highcharts width table 绘制 Highcharts

  • 代码案例
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>Highcharts Example</title>

		<style type="text/css">
.highcharts-figure,
.highcharts-data-table table {
    min-width: 320px;
    max-width: 500px;
    margin: 1em auto;
}

.highcharts-data-table table {
    font-family: Verdana, sans-serif;
    border-collapse: collapse;
    border: 1px solid #ebebeb;
    margin: 10px auto;
    text-align: center;
    width: 100%;
    max-width: 500px;
}

.highcharts-data-table caption {
    padding: 1em 0;
    font-size: 1.2em;
    color: #555;
}

.highcharts-data-table th {
    font-weight: 600;
    padding: 0.5em;
}

.highcharts-data-table td,
.highcharts-data-table th,
.highcharts-data-table caption {
    padding: 0.5em;
}

.highcharts-data-table thead tr,
.highcharts-data-table tr:nth-child(even) {
    background: #f8f8f8;
}

.highcharts-data-table tr:hover {
    background: #f1f7ff;
}

input[type="number"] {
    min-width: 50px;
}

		</style>
	</head>
	<body>
<script src="../../code/highcharts.js"></script>
<script src="../../code/modules/exporting.js"></script>
<script src="../../code/modules/accessibility.js"></script>

<figure class="highcharts-figure">
    <div id="container"></div>
    <!-- <p class="highcharts-description">
        Pie charts are very popular for showing a compact overview of a
        composition or comparison. While they can be harder to read than
        column charts, they remain a popular choice for small datasets.
    </p> -->
</figure>



		<script type="text/javascript">
Highcharts.chart('container', {
    chart: {
        type: 'pie'
    },
    title: {
        text: 'Egg Yolk Composition'
    },
    tooltip: {
        valueSuffix: '%'
    },
    subtitle: {
        text:
        'Source:<a href="https://www.mdpi.com/2072-6643/11/3/684/htm" target="_default">MDPI</a>'
    },
    plotOptions: {
        series: {
            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: [{
                enabled: true,
                distance: 20
            }, {
                enabled: true,
                distance: -40,
                format: '{point.percentage:.1f}%',
                style: {
                    fontSize: '1.2em',
                    textOutline: 'none',
                    opacity: 0.7
                },
                filter: {
                    operator: '>',
                    property: 'percentage',
                    value: 10
                }
            }]
        }
    },
    series: [
        {
            name: 'Percentage',
            colorByPoint: true,
            data: [
                {
                    name: 'Water',
                    y: 55.02
                },
                {
                    name: 'Fat',
                    sliced: true,
                    selected: true,
                    y: 26.71
                },
                {
                    name: 'Carbohydrates',
                    y: 1.09
                },
                {
                    name: 'Protein',
                    y: 15.5
                },
                {
                    name: 'Ash',
                    y: 1.68
                }
            ]
        }
    ]
});

		</script>
	</body>
</html>
  • 效果图

标签:name,true,data,highcharts,width,table,绘制,Highcharts
From: https://www.cnblogs.com/dogleftover/p/18221862

相关文章

  • AnyChart绘制折线图
    代码案例<html><head><scriptsrc="https://cdn.anychart.com/releases/v8/js/anychart-base.min.js"></script><scriptsrc="https://cdn.anychart.com/releases/v8/js/anychart-ui.min.js"></script......
  • 使用python绘制一个五颜六色的爱心
    使用python绘制一个五颜六色的爱心介绍效果代码介绍使用numpy与matplotlib绘制一个七彩爱心!效果代码importnumpyasnpimportmatplotlib.pyplotasplt#Heartshapefunctiondefheart_shape(t):x=16*np.sin(t)**3y=13*np.cos(t)-5*......
  • 统计不同文件夹中的文件数量,并绘制相应的柱状图。
    一、数据类型每个文件夹下都是这种文件,虽然可以通过手动数出来了解文件数量,但为了更直观地看到每个文件夹的文件数量,可以使用图表来表示,这样会更加清晰。效果展示:  二、代码实现 importosimportmatplotlib.pyplotaspltfolder_names=['0','1','2','3']......
  • Cesium4Unreal - # 002 线图元绘制
    文章目录基础点绘制1思路2步骤2.1创建一个自定义组件2.2重写CreateSceneProxy方法2.3实现自定义的场景代理类2.4在场景代理类中实现绘制逻辑2.5使用自定义组件3代码实现3.1c++代码3.1.1自定义组件代码MyPrimitivePointComponent.hMyPri......
  • 测试[C#]GDI+中使用BitBlt绘制图像到窗口
    安神颗粒的哈喽###2024-5-28WindowsFormPaintFormTES_ESEB测试[C#]GDI+中使用BitBlt绘制图像到窗口```#region测试[C#]GDI+中使用BitBlt绘制图像到窗口privatevoidpbx01_Paint(objectsender,PaintEventArgse){#regionMyRegion......
  • ZingChart绘制错误信息面积图
    代码案例<!doctypehtml><html><head><metacharset="utf-8"><title>ZingSoftDemo</title><scriptnonce="undefined"src="https://cdn.zingchart.com/zingchart.min.js"></script&g......
  • Vue+OpenLayers7入门到实战:OpenLayers实现在地图上拖拽编辑修改绘制图形
    返回《Vue+OpenLayers7》专栏目录:Vue+OpenLayers7入门到实战前言本章介绍如何使用OpenLayers7在地图上拖拽编辑修改绘制图形。在前面一章中,我们已经学会了如何绘制基础的三种图形线段、圆形和多边形:《Vue+OpenLayers7入门到实战:OpenLayers图形绘制功能,OpenLayers实现在地......
  • 详解PySide多线程【Python-Pyside图形界面绘制#2】
    在了解pyside多线程之前,如果是初学者可以先去看看我的第一篇文章《超详细实例详解Python多线程》,文中有对多线程的概念进行详细介绍,如果有相关基础可直接跳过。【Python】超详细实例讲解python多线程(threading模块)_pythonthreading介绍-CSDN博客https://blog.csdn.net/Xiao_......
  • iOS开发_绘制圆角矩形虚线环
    -(void)drawRect:(CGRect)rect{//获取上下文(/画笔/绘图环境)CGContextRefcontext=UIGraphicsGetCurrentContext();//小段长度CGFloatline_dash=self.height/20;//虚线的样式:长5空隙15长10空隙30长2空隙20...//CGFloa......
  • Vue3标签组件绘制--自定义按钮组件
    不知道怎么的,突然想绘制一个标签,比如el-button什么的。今天研究一下吧,不知道能不能整出来以后就可以绘制自己的组件,弄自己的组件库了。不知道有朝一日能不能让越组件青史留名?嘻嘻,百日梦做差不多了,接着去查查资料。文章分为三个部分:1.按钮组件实现(根据查阅的一个文章实现基......