简体   繁体   English

使用带有多行的JSON填充图表时,Google Chart中的工具提示

[英]Tooltip in Google Chart while populating chart using JSON with multiple line

Using stackoverflow i'm doing my own chart with Google. 使用stackoverflow我正在与Google做我自己的图表。 I've read this: Tooltip in Google Chart while populating chart using JSON and with this "instruction" i've tried to do with myself a multi line chart with custom tooltip but without results. 我已经读过: Google图表中的工具提示,同时使用JSON和此“说明” 填充图表时 ,我尝试使用具有自定义工具提示但没有结果的多折线图来处理自己。

I've tried something like that 我已经尝试过类似的东西

{"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"}]}
]}

What is wrong in that? 那有什么问题呢? I want to specify that: with single line (copying the code of the link above) this works fine and i've my good chart :D Anyone can help me? 我想指定:用一行(复制上面链接的代码)可以正常工作,我的图表很好:D任何人都可以帮助我吗?

You are missing a comma after your first tooltip column: 在第一个工具提示列之后,您缺少逗号:

"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" } } 
]

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

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