如何在Highchart.js中制作的条形图中突出显示条形?在HighCharts中高亮条形条形图
假设我有一个成功的条形图,失败,警告(全部在一个数组中),并且成功得分太高,它会使错误栏变矮,并且不容易看见。如果值> 0,我想使'错误栏'出色。
RenderBarChart('service_stats'+x, [
{y:1000, color: 'green', url:'http://www.google.com'},
{y:5, color: 'red', url:'http://www.googl22e.com'},
{y:6, color: 'orange', url:'http://www.googl22e.com'},
{y:7, color: 'yello', url:'http://www.googl22e.com'},
], 'servidsace_stats');
function RenderBarChart(elementId, dataList, name) {
new Highcharts.Chart({
chart: {
renderTo: elementId,
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: true
},
title: {
text: 'Host Statistics'
},
subtitle: {
text: 'Cluster: Appservers'
},
xAxis: {
categories: ['OK', 'CRITICAL', 'WARNING', 'UNKNOWN'],
title: {
text: null
}
},
yAxis: {
title: {
text: null,
},
},
plotOptions: {
bar: {
dataLabels: {
enabled: true
}
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: 100,
y: 100,
floating: false,
borderWidth: 1,
backgroundColor: '#FFFFFF',
shadow: false
},
credits: {
enabled: false
},
series:[{
type: 'bar',
name: name,
data: dataList,
cursor: 'pointer',
point: {
events: {
click: function() {
location.href = this.options.url;
}
}
}
}]
}
增加错误栏的宽度并不会帮助。缩放高度可能有帮助,但无法做到。
事情是这样的http:// www.highcharts.com/demo/error-bar?你有没有你的图表模型? –
@sebastian没有帮助。我只想强调一下吧。不添加任何东西。 – user1579557
你能改说吗?这听起来像是你说如果'分数'值太高[每个成功都是+1分?],那么该条应该被突出显示......但是你有一个数据数组 - dataList'包含所有的成功,失败和警告? –