简体   繁体   English

高图-面积图的每个点都有不同的标记

[英]Highcharts - Different Marker for Each Point of Area Plot

I'm trying to have a different marker for each point in my Highcharts area plot. 我正在为Highcharts区域图中的每个点尝试使用不同的标记。 I want the marker to be a wind barb png (shows the average wind direction and speed for a month), which is generated by the icons.php script on-demand. 我希望标记是一个风倒钩png(显示一个月的平均风向和风速),它是按需由icons.php脚本生成的。 Here is what I have for my data block in my series: 这是我的系列数据块中的内容:

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)'}}]},
],

I've even tried this with the url being to a static image. 我什至尝试将网址设置为静态图片。 I still get this same error in Firebug: 我仍然在Firebug中遇到这个错误:

TypeError: f[a] is undefined

Any help is greatly appreciated! 任何帮助是极大的赞赏!

Your problem is the x value being a string and not an integer/decimal value. 您的问题是x值是一个字符串,而不是整数/十进制值。 The x categories are set separately from the data. x类别与数据分开设置。 Fiddle example from highcharts 高图的小提琴例子

    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
            'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },

is separate from 与...分开

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]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM