This article mainly introduces the effect of jQuery plug-in HighCharts to draw a 2D donut chart, and analyzes the implementation steps and related operating techniques of jQuery using the HighCharts plug-in to draw a donut chart in the form of examples. It also comes with demo source code for readers to download and refer to. Friends in need You can refer to it, I hope it can help everyone.
The example in this article describes the effect of drawing a 2D donut chart with the jQuery plug-in HighCharts. Share it with everyone for your reference, the details are as follows:
1. Example code:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>HighCharts 2D圆环图</title> <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script> <script type="text/javascript" src="js/highcharts.js"></script> <script type="text/javascript"> $(function(){ var colors = Highcharts.getOptions().colors, categories = ['花', '树', '鱼', '鸟', '鲸'], name = 'Browser brands', data = [{ y: 55.11, color: colors[0], drilldown: { name: '花的种类', categories: ['梅花', '桃花', '梨花', '樱花'], data: [13.6, 7.35, 33.06, 2.81], color: colors[0] } }, { y: 21.63, color: colors[1], drilldown: { name: '树的种类', categories: ['樟树', '桉树', '茶树', '桃树', '梨树'], data: [15.20, 3.83, 18.58, 13.12, 45.43], color: colors[1] } }, { y: 11.94, color: colors[2], drilldown: { name: '鱼的种类', categories: ['鲫鱼', '鲢鱼', '草鱼', '青鱼', '鲦鱼','鳙鱼', '鲥鱼'], data: [41.12, 10.19, 11.12, 14.36, 21.32, 9.91, 17.50], color: colors[2] } }, { y: 7.15, color: colors[3], drilldown: { name: '鸟的种类', categories: ['松鸡', '卷尾', '鹪鹩', '岩鹨', '山鹑','画眉', '金鸡'], data: [14.55, 19.42, 16.23, 16.21, 18.20, 23.19, 10.14], color: colors[3] } }, { y: 2.14, color: colors[4], drilldown: { name: '鲸的种类', categories: ['须鲸', '蓝鲸', '虎鲸'], data: [ 24.12, 18.37, 32.65], color: colors[4] } }]; // 构建物种数据 var speciesData = []; var speData = []; for (var i = 0; i < data.length; i++) { // 添加物种数据 speciesData.push({ name: categories[i], y: data[i].y, color: data[i].color }); for (var j = 0; j < data[i].drilldown.data.length; j++) { var brightness = 0.4 - (j / data[i].drilldown.data.length) / 5 ; speData.push({ name: data[i].drilldown.categories[j], y: data[i].drilldown.data[j], color: Highcharts.Color(data[i].color).brighten(brightness).get() }); } } // 创建圆环图 $('#donutChart').highcharts({ chart: { type: 'pie' }, title: { text: '物种数量及其比例' }, yAxis: { title: { text: '比例' } }, plotOptions: { pie: { shadow: true, center: ['50%', '50%'] } }, tooltip: { valueSuffix: '%' }, series: [{ name: '物种', data: speciesData, size: '70%', dataLabels: { formatter: function() { return this.y > 5 ? this.point.name : null; }, color: 'white', distance: -30 } }, { name: '数量', data: speData, size: '80%', innerSize: '80%', dataLabels: { formatter: function() { return this.y > 1 ? '<b>'+ this.point.name +':</b> '+ this.y +'%' : null; } } }] }); }); </script> </head> <body> <p id="donutChart" style="width: 1250px; height: 550px; margin: 0 auto"></p> </body> </html>
2. Operation rendering:
Related recommendations:
HighCharts draws 2D pie chart effect with Legend to share examples
Details on how to pass PHP dynamically transfers data to highcharts
Example code of highcharts usage
The above is the detailed content of HighCharts drawing 2D donut chart effect example sharing. For more information, please follow other related articles on the PHP Chinese website!

如何在Highcharts中使用动态数据来展示实时数据随着大数据时代的到来,对于实时数据的展示变得越来越重要。Highcharts作为一种流行的图表库,提供了丰富的功能和可定制性,使得我们可以灵活地展示实时数据。本文将介绍如何在Highcharts中使用动态数据来展示实时数据,并给出具体的代码示例。首先,我们需要准备一个能够提供实时数据的数据源。在本文中,我

如何在Highcharts中使用桑基图来展示数据桑基图(SankeyDiagram)是一种用于可视化流量、能源、资金等复杂流程的图表类型。它能清晰展示各个节点之间的关系和流动情况,可以帮助我们更好地理解和分析数据。在本文中,我们将介绍如何使用Highcharts来创建和定制一个桑基图,并附上具体的代码示例。首先,我们需要加载Highcharts库和Sank

如何在Highcharts中使用堆叠图表来展示数据堆叠图表是一种常见的数据可视化方式,它可以同时展示多个数据系列的总和,并以柱状图的形式显示每个数据系列的贡献。Highcharts是一款功能强大的JavaScript库,提供了丰富的图表种类和灵活的配置选项,可以满足各种数据可视化的需求。在本文中,我们将介绍如何使用Highcharts来创建一个堆叠图表,并提

如何使用Highcharts创建甘特图表,需要具体代码示例引言:甘特图是一种常用于展示项目进度和时间管理的图表形式,能够直观地展示任务的开始时间、结束时间和进度。Highcharts是一款功能强大的JavaScript图表库,提供了丰富的图表类型和灵活的配置选项。本文将介绍如何使用Highcharts创建甘特图表,并给出具体的代码示例。一、Highchart

如何使用Highcharts创建地图热力图,需要具体代码示例热力图是一种可视化的数据展示方式,能够通过不同颜色深浅来表示各个区域的数据分布情况。在数据可视化领域,Highcharts是一个非常受欢迎的JavaScript库,它提供了丰富的图表类型和交互功能。本文将介绍如何使用Highcharts创建地图热力图,并提供具体的代码示例。首先,我们需要准备一些数据

如何利用Highcharts创建自定义图表Highcharts是一个功能强大且易于使用的JavaScript图表库,它可以帮助开发人员创建各种类型的交互式和可定制化的图表。为了利用Highcharts创建自定义图表,我们需要掌握一些基本概念和技术。本文将介绍一些重要的步骤,并提供具体的代码示例。步骤一:引入Highcharts库首先,我们需要在HTML文件中

如何在Highcharts中使用地图来展示数据引言:在数据可视化领域中,使用地图来展示数据是一种常见且直观的方式。Highcharts是一款强大的JavaScript图表库,提供了丰富的功能和灵活的配置选项。本文将介绍如何在Highcharts中使用地图来展示数据,并提供具体的代码示例。介绍地图数据:在使用地图时,首先需要准备地图数据。High

如何在Highcharts中使用散点图来展示数据前言Highcharts是一个开源的JavaScript图表库,提供了丰富的图表类型和强大的定制化功能。其中,散点图是一种常用的数据可视化方式,可以展示两个变量之间的关系以及变量的分布情况。本文将介绍如何在Highcharts中使用散点图来展示数据,并提供具体的代码示例。步骤一:引入Highcharts库


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver CS6
Visual web development tools
