我正在更改我的 x 轴值的标签。尝试完成此操作后,没有显示 x 轴标签。
Javascript代码
$(document).ready(function() {
var labels = [ '5/7','5/7','5/7','5/7','5/7','5/7','5/7','5/7','5/7','5/7' ];
chart = new Highcharts.Chart({
chart: { renderTo:'chart_container' },
title: { text: 'Rev Load' },
xAxis: { categories: ['5/7 64298-R3', '5/7 64308-R3', '5/7 64311-R3', '5/7 64312-R3', '5/7 64302-R3', '5/7 64307-R3', '5/7 64309-R3', '5/7 64297-R3', '5/7 64310-R3', '5/7 64305-R3'], labels: {
formatter: function() { return labels[this.value];} },
tickInterval: 3 },
yAxis: { max: 0.0018, min: 0.0014, plotLines: [{ color: 'red', dashStyle: 'shortDash', value: 0.0018, width: 2 }, { color: 'red', dashStyle: 'shortDash', value: 0.0014, width: 2 }], title: { text: '' } },
series: [{ data: [0.00150, 0.00170, 0.00140, 0.00180, 0.00150, 0.00160, 0.00140, 0.00150, 0.00180, 0.00160], name: 'Values' }]
});
C# 点网代码
chart.SetXAxis(new XAxis
{
Categories = categories.ToArray(),
TickInterval = 3,
Labels = new XAxisLabels { Formatter = "function() { labels[this.value];} " }
});
当前显示的屏幕截图
如屏幕截图所示,缺少点的 x 轴标签。
PS 我指的不是 x 轴标题,而是x-axis labels
.
背景资料
- 技术:ASP.NET MVC3 DotNet C#
- DotNet Highcharts 库:http ://dotnethighcharts.codeplex.com/
如果对问题有任何误解,请告诉我。感谢您的帮助和帮助!
编辑 - 我解决了缺少return
关键字的问题,但看起来它仍然没有显示标签