클릭 할 때마다 재구성하는 하이 차트가 있습니다. 차트 값은 쿼리에 의해 동적으로 생성되며이를 Chartdata array
으로 푸시합니다.하이 차트 - 백분율에 따라 색상을 지정하는 방법
모든 쿼리 결과 후 가장 큰 조각에 노란색을 주려고하지만 배열 인덱스에서 항상 가장 큰 값이 변경됩니다. 내가 어떻게 해?
var chartDataArray = [
{name:"A", y: 19},
{name:"B", y: 49},
{name:"C", y: 32}
];
항상 'y'가 가장 높은 곳에 노란색으로 표시하고 싶습니다.
Highcharts.chart('container', {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie',
style: {
fontFamily: 'sfprodisplay',
fontSize: '20px',
left: '0',
top: '0'
}
},
title: {
text: ''
},
credits: {
enabled: false
},
exporting: {
enabled: false
},
tooltip: {
formatter: function() {
return this.point.name + '<br/>% ' + Math.round(this.point.percentage) + '<br/>' + (this.point.custom ? this.point.custom : "")
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
//format: '% {point.percentage:.0f}<br/>{point.custom}',
formatter: function() {
return "% " + Math.round(this.point.percentage) + "<br/>" + (this.point.custom ? this.point.custom : this.point.name)
},
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
}
}
},
series: [{
name: '',
colorByPoint: true,
data: chartData
}]
});
피들을 만들 수 있습니까? –
add ", color : '# ffff00'"을 chartDataArray의 가장 높은 지점에 붙이십시오. – krisph
나는 동적이어야한다고 생각합니다. –