Jquery 如何在海图中设计不同的Collor Coulmn
您能看一下并告诉我如何为图表中的每一列设置不同的颜色吗Jquery 如何在海图中设计不同的Collor Coulmn,jquery,highcharts,Jquery,Highcharts,您能看一下并告诉我如何为图表中的每一列设置不同的颜色吗 $(function () { $('#container').highcharts({ chart: { type: 'column' }, title: { text: 'World\'s largest cities per 2014' },
$(function () {
$('#container').highcharts({
chart: {
type: 'column'
},
title: {
text: 'World\'s largest cities per 2014'
},
subtitle: {
text: 'Source: <a href="http://en.wikipedia.org/wiki/List_of_cities_proper_by_population">Wikipedia</a>'
},
xAxis: {
type: 'category',
labels: {
align: 'center',
style: {
fontSize: '13px',
fontFamily: 'Verdana, sans-serif'
}
}
},
yAxis: {
min: 0,
title: {
text: 'Population (millions)'
}
},
legend: {
enabled: false
},
tooltip: {
pointFormat: 'Population in 2008: <b>{point.y:.1f} millions</b>',
},
series: [{
name: 'Population',
data: [
['Shanghai', 23.7],
['Lagos', 16,1],
['Instanbul', 14.2],
],
dataLabels: {
enabled: true,
rotation: 0,
color: '#FFFFFF',
align: 'center',
x: 5,
y: 25,
style: {
fontSize: '14px',
fontFamily: 'Verdana, sans-serif',
textShadow: '0 0 3px black'
}
}
}]
});
});
$(函数(){
$(“#容器”)。高图({
图表:{
类型:“列”
},
标题:{
文字:“2014年世界最大城市”
},
副标题:{
文本:“来源:”
},
xAxis:{
类型:'类别',
标签:{
对齐:'居中',
风格:{
fontSize:'13px',
fontFamily:“Verdana,无衬线”
}
}
},
亚克斯:{
分:0,,
标题:{
正文:“人口(百万)”
}
},
图例:{
已启用:false
},
工具提示:{
pointFormat:'2008年人口:{point.y:.1f}百万',
},
系列:[{
姓名:'人口',
数据:[
[‘上海’,23.7],
['Lagos',16,1],
[Instanbul',14.2],
],
数据标签:{
启用:对,
轮换:0,
颜色:“#FFFFFF”,
对齐:'居中',
x:5,
y:25,
风格:{
fontSize:'14px',
fontFamily:“Verdana,无衬线”,
textShadow:'0 0 3px黑色'
}
}
}]
});
});
谢谢你可以用两种不同的方法来做。首先,您可以显式地为每个点指定其自己的颜色,这还涉及在
数据
元素(名称
,y
等)中显式地键入彼此的值:
其次,可以使用依赖于Highcharts颜色数组的参数来指定它。使用可用于条
和列
类型的系列属性(至少):
现场直播。非常感谢wergeld。这正是我想要的。我一直这么说,但我真的推荐highchart的API文档。大量的实例。有些东西不完全受支持,所以API文档中不支持,但您可以检查highcharts对象以查看公开的内容。很漂亮的东西。
data: [
{name: 'Shanghai', color: 'red', y: 23.7},
{name: 'Lagos', color: 'blue', y: 16.1},
{name: 'Instanbul', color: 'green', y:14.2}
]
...
name: 'P2',
colorByPoint: true,
data: ...