1
我正在改变我的x轴值的标签。尝试完成后,没有任何x轴标签的显示。Highcharts:我正在更换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#代码DOTNET的
chart.SetXAxis(new XAxis
{
Categories = categories.ToArray(),
TickInterval = 3,
Labels = new XAxisLabels { Formatter = "function() { labels[this.value];} " }
});
什么当前显示
由于截图SH截图允许点的x轴标签丢失。
P.S.我不是指x轴标题,而是x-axis labels
。
背景信息
- 技术:ASP.NET MVC3 DOTNET的C#
- DOTNET的Highcharts库:http://dotnethighcharts.codeplex.com/
请让我知道是否有该问题的任何误解。感谢您的帮助和帮助!
编辑 - 我固定的问题与缺失return
关键字,但它看起来像它仍然没有显示标签
哇哦......这样一个愚蠢的错误。 haha – AustinT 2013-05-09 15:03:32
我修正了这个错误,因为我更新了我的文章。但看起来标签仍然没有显示。 – AustinT 2013-05-09 15:06:17
更新了我的答案 - 传递给格式化程序函数的值不是索引。 – mike 2013-05-10 04:25:13