我正在使用角度和高度新图表开发应用程序。我要求将标题放置在条形图的第一个标记旁边,并且值是动态的。这是现有代码https://jsfiddle.net/manoj_rejinthala1510/698mhz2k/3/。
Highcharts.chart('container', {
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
},
yAxis: {
title: {
text: '<b>Target</b>',
rotation: 0
}
},
legend: {
enabled: false
},
credits: {
enabled: false
},
series: [{
type: 'area',
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
},
{
type: 'line',
data: [50,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,]
}]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>
任何人都可以帮助我实现这一目标。提前致谢。
您可以在render
事件中动态放置标题,例如:
chart: {
events: {
load: function() {
var yAxis = this.yAxis[0],
title = yAxis.axisTitle,
firstTick = yAxis.ticks[yAxis.tickPositions[1]];
title.attr({
y: firstTick.label.xy.y
});
}
}
}
现场演示: https : //jsfiddle.net/BlackLabel/30c26hgx/
API参考: https ://api.highcharts.com/highcharts/chart.events.render
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句