【问题标题】:Tooltip in Google Chart while populating chart using JSON with multiple line使用多行 JSON 填充图表时 Google 图表中的工具提示
【发布时间】:2013-11-05 16:13:54
【问题描述】:

我正在使用 stackoverflow 使用 Google 制作自己的图表。 我读过这个: Tooltip in Google Chart while populating chart using JSON 并根据这个“指令”,我尝试用自定义工具提示为自己制作一个多折线图,但没有结果。

我尝试过类似的方法

{"cols": [{"id": "", "label": "Date", "type": "string"},
    {"id": "", "label": "price", "type": "number"},
    {"id": "", "role": "tooltip", "type": "string", "p" : { "role" : "tooltip" } } 
    {"id": "", "label": "price2", "type": "number"},
    {"id": "", "role": "tooltip", "type": "string", "p" : { "role" : "tooltip" } } 
],
"rows": [
    {"c":[{"v": "Apr 24th","f":"null"}, {"v": 56000,"f":"56000"}, {"v": "24 April, Price - 56000, Seller-abcd"}, {"v": 50000,"f":"56000"}, {"v": "24 April, Price - 56000, Seller-abcd"}]},
    {"c":[{"v": "May 3rd","f":"null"}, {"v": 68000,"f":"68000"}, {"v": "3 May, Price - 68000, Seller-abcd"}, {"v": 56000,"f":"56000"}, {"v": "24 April, Price - 56000, Seller-abcd"}]},
    {"c":[{"v": "May 13th","f":"null"}, {"v": 50400,"f":"50400"}, {"v": "23 May, Price - 50000, Seller-abcd"}, {"v": 56000,"f":"56000"}, {"v": "24 April, Price - 66000, Seller-abcd"}]}
]}

这有什么问题?我想指定:单行(复制上面链接的代码)这工作正常,我有我的好图表:D 谁能帮帮我?

【问题讨论】:

    标签: javascript json charts google-visualization tooltip


    【解决方案1】:

    您在第一个工具提示列之后缺少一个逗号:

    "cols": [
        {"id": "", "label": "Date", "type": "string"},
        {"id": "", "label": "price", "type": "number"},
        {"id": "", "role": "tooltip", "type": "string", "p" : { "role" : "tooltip" } }, // <--- need a comma here
        {"id": "", "label": "price2", "type": "number"},
        {"id": "", "role": "tooltip", "type": "string", "p" : { "role" : "tooltip" } } 
    ]
    

    【讨论】:

    • 谢谢你,兄弟,我太累了,对我来说这个逗号就像...... COMA!
    猜你喜欢
    • 1970-01-01
    • 2014-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-12
    • 2015-02-19
    • 1970-01-01
    相关资源
    最近更新 更多