当前位置:网站首页>29.学习Highcharts 使用百分比的堆叠柱形图
29.学习Highcharts 使用百分比的堆叠柱形图
2022-07-27 20:57:00 【微服务商城技术分享】
Highcharts 使用百分比的堆叠柱形图
以下实例演示了使用百分比的堆叠柱形图。
我们在前面的章节已经了解了 Highcharts 基本配置语法。接下来让我们来看下其他的配置。在 plotOptions 中添加 stacking 属性:

配置
plotOptions:数据点选项
plotOptions用于设置图表中的数据点相关属性。plotOptions根据各种图表类型,其属性设置略微有些差异。
配置图表堆叠设置 plotOptions.area.stacking 为 "percent"。如果禁用堆叠使用 null。
var plotOptions = {
column: {
stacking: 'percent'
}
};实例
文件名:highcharts_column_percentage.htm
<html>
<head>
<meta charset="UTF-8" />
<title>Highcharts 教程 | xx教程(xxxxxx.com)</title>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
</head>
<body>
<div id="container" style="width: 550px; height: 400px; margin: 0 auto"></div>
<script language="JavaScript">
$(document).ready(function() {
var chart = {
type: 'column'
};
var title = {
text: '堆叠柱形图'
};
var xAxis = {
categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
};
var yAxis ={
min: 0,
title: {
text: '水果总消费量'
}
};
var tooltip = {
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.percentage:.0f}%)<br/>',
shared: true
};
var plotOptions = {
column: {
stacking: 'percent'
}
};
var credits = {
enabled: false
};
var series= [{
name: 'John',
data: [5, 3, 4, 7, 2]
}, {
name: 'Jane',
data: [2, 2, 3, 2, 1]
}, {
name: 'Joe',
data: [3, 4, 4, 2, 5]
}];
var json = {};
json.chart = chart;
json.title = title;
json.xAxis = xAxis;
json.yAxis = yAxis;
json.tooltip = tooltip;
json.plotOptions = plotOptions;
json.credits = credits;
json.series = series;
$('#container').highcharts(json);
});
</script>
</body>
</html>以上实例输出结果为:

边栏推荐
- 四次挥手的Socket交互流程
- What are the methods of process synchronization?
- 我年薪100万,全身上下没有超过100块的衣服:存钱,是最顶级的自律
- [signal processing] weak signal detection in communication system based on the characteristics of high-order statistics with matlab code
- 在所有浏览器中禁用带有元 HTML 标记的缓存
- Date的使用
- 如何快捷地查看H.265视频播放器EasyPlayer的API属性及其使用方法?
- 台积电3nm细节曝光:晶体管密度高达2.5亿个/mm²,性能及能效大幅提升
- [number recognition] recognize 0-9 numbers based on Hopfield neural network with matlab code
- 【GNN报告】加拿大蒙特利尔唐建:Geometric Deep Learning For Drug Discovery
猜你喜欢

Implicit indicators for evaluating the advantages and disadvantages of automated testing

远程调试 idea配置remote debug、在远程服务器的程序中,添加JVM启动参数-Xdebug

数据管理的重点

【信号处理】基于高阶统计量特征的通信系统中微弱信号检测附matlab代码

Record the errors about formatc in R language
Software test function test full set of common interview questions [function test] interview summary 4-2

【12月海口】2022年第六届船舶,海洋与海事工程国际会议(NAOME 2022)
![[elm classification] classification of UCI data sets based on nuclear limit learning machine and limit learning machine, with matlab code](/img/bd/fe105f0af3a24ad6f220fa35bb5e8d.png)
[elm classification] classification of UCI data sets based on nuclear limit learning machine and limit learning machine, with matlab code

Starfish Os X MetaBell战略合作,元宇宙商业生态更进一步
![[image defogging] image defogging based on dark channel and non-mean filtering with matlab code](/img/44/6120682f9571f6ad35f8b9249b7fea.png)
[image defogging] image defogging based on dark channel and non-mean filtering with matlab code
随机推荐
采用汇顶屏下光学指纹方案,三星Galaxy A71 5G上市
Sudden, wechat important notice
四次挥手的Socket交互流程
Application of user portrait in precise push of wechat official account of scientific journals
如何快捷地查看H.265视频播放器EasyPlayer的API属性及其使用方法?
With double-digit growth in revenue and profit, China Resources Yibao has quietly created these new products worth more than 100 million
NDK series (6): let's talk about the way and time to register JNI functions
记录一下使用R语言中关于formatC的错误
Spark 离线开发框架设计与实现
XML 外部实体 (XXE) 漏洞及其修复方法
Nature综述:微生物群落形成过程中的优先效应
What technology is RPA process automation robot? How to realize office automation?
2019年全球十大半导体厂商:英特尔重回第一,苹果逆势大涨
Exercise --- BFS
How to quickly view the API properties and usage of the h.265 video player easyplayer?
【软考软件评测师】2014综合知识历年真题
Bi Shi - University Logistics Management System Based on SSM
Software test function test full set of common interview questions [function test] interview summary 4-2
Lua基础语法学习
js数组复制速度测试220320