我正在尝试为我的Highcharts区域图中的每个点设置不同的标记。我希望标记为风倒钩png(显示一个月的平均风向和速度),这是由按需的icons.php脚本生成的。以下是我的系列数据块中的内容:
series:[{
data:[
{ x: 'January', y: 3717.71, marker:{ symbol: 'url(http://sample.ip.address/icons.php?type=barb&size=5&wspd=0&dir=219.38009049774)'}},
{ x: 'February', y: 3894.63, marker:{ symbol: 'url(http://sample.ip.address/icons.php?type=barb&size=5&wspd=0&dir=215.49200799201)'}},
{ x: 'March', y: 3628.49, marker:{ symbol: 'url(http://sample.ip.address/icons.php?type=barb&size=5&wspd=0&dir=193.80027422303)'}},
{ x: 'April', y: 2901.39, marker:{ symbol: 'url(http://sample.ip.address/icons.php?type=barb&size=5&wspd=0&dir=180.85734200743)'}},
{ x: 'May', y: 1756.8, marker:{ symbol: 'url(http://sample.ip.address/icons.php?type=barb&size=5&wspd=0&dir=171.72764227642)'}},
{ x: 'June', y: 1290.4, marker:{ symbol: 'url(http://sample.ip.address/icons.php?type=barb&size=5&wspd=0&dir=191.62322274882)'}},
{ x: 'July', y: 997.85, marker:{ symbol: 'url(http://sample.ip.address/icons.php?type=barb&size=5&wspd=0&dir=187.95557570263)'}},
{ x: 'August', y: 1035.04, marker:{ symbol: 'url(http://sample.ip.address/icons.php?type=barb&size=5&wspd=0&dir=180.14449541284)'}},
{ x: 'September', y: 1650.05, marker:{ symbol: 'url(http://sample.ip.address/icons.php?type=barb&size=5&wspd=0&dir=173.00561797753)'}},
{ x: 'October', y: 3154.83, marker:{ symbol: 'url(http://sample.ip.address/icons.php?type=barb&size=5&wspd=0&dir=188.1064690027)'}},
{ x: 'November', y: 3158.45, marker:{ symbol: 'url(http://sample.ip.address/icons.php?type=barb&size=5&wspd=0&dir=192.06400742115)'}},
{ x: 'December', y: 4075.64, marker:{ symbol: 'url(http://sample.ip.address/icons.php?type=barb&size=5&wspd=0&dir=215.48698384201)'}}]},
],
我甚至尝试过将这个url用于静态图像。我仍然在Firebug中遇到同样的错误:
TypeError: f[a] is undefined
非常感谢任何帮助!
答案 0 :(得分:3)
您的问题是x值是字符串而不是整数/小数值。 x类别与数据分开设置。 Fiddle example from highcharts
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
与
分开data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, {
y: 26.5,
marker: {
symbol: 'url(http://www.YOURLINK.com/test.png)'
}
}, 23.3, 18.3, 13.9, 9.6]