【问题标题】:Getting extra series data from hash to show up in tooltip in highstock从哈希中获取额外的系列数据以显示在 highstock 的工具提示中
【发布时间】:2014-03-11 03:16:04
【问题描述】:

我已经获得了在 highcharts 中使用此功能的示例,但我无法在 highstocks 中使用此功能。我试图让我的工具提示显示有关系列中提供的点的一些额外信息,但似乎我放入系列数据哈希中的值没有正确保存。 X 和 Y 字段设置正常,因为我可以看到正确显示的图表,但我的其他“水果”和“名称”字段在工具提示中报告为空。

这是我的系列数据的示例:

{
    name: 'food1',
    fruit: 'apple',
    x: Date.UTC(2010, 0, 1),
    y: 216.4                
},
{
    name: 'food2',
    fruit: 'banana',
    x: Date.UTC(2010, 0, 4),
    y: 116.4                
}

这是我的工具提示格式化程序中的循环:

$.each(this.points, function(i, point) {
    s += '<br/>Name is = '+ point.name;
    s += '<br/>y is = '+point.y;
    s += '<br/>Fruit is = ' +point.fruit;
});

工具提示将显示: 名称是:未定义 y 是:216.4 水果是:未定义

我希望它显示: 名称是:food1 y 是:216.4 水果是:苹果

这里是 jsfiddle 链接: http://jsfiddle.net/hYtUj/5/

【问题讨论】:

    标签: highcharts highstock series


    【解决方案1】:

    您以错误的方式访问属性

    应该是这样的

    $.each(this.points, function(i, point) { s += '<br/>Name is = '+ point.point.name; s += '<br/>y is = '+point.y; s += '<br/>Fruit is = ' +point.point.fruit; });

    更新了你的小提琴here

    希望对你有帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-06-15
      • 1970-01-01
      • 1970-01-01
      • 2021-07-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多