gpt4 book ai didi

d3.js - 将用户评论存储到 d3js 图表中的数据点

转载 作者:行者123 更新时间:2023-12-01 11:39:10 24 4
gpt4 key购买 nike

我们需要找到或从头开始构建一个工具,用于收集用户对他们查看的图表的反馈。科学家评论一些获得的分布就是一个典型的例子。一般来说,这应该是某种针对d3js

的集体讨论层

我想,这个想法并不新鲜,几年前我什至看到过原型(prototype)。谁能指出可能有用的现有解决方案或框架?

最简单的用例 - Bob 看到 d3js 散点图并观察到左上角的奇怪异常值 A。他点击它并写下评论——“这次观察的所有条件都正常吗?”。当 John 进入系统并单击 A 时,他可以阅读评论并回复 smth,例如“这只是我的猫跑过键盘”。

这个逻辑可以有很多扩展,所以最好使用现有的工具。

最佳答案

如果评论必须在一个点上完成,你可以考虑在 json 中组织数据,例如

{
"x":10,
"y":20,
"comments":[
{
"name":"Bob",
"content":"Was all conditions normal for this observation?",
"replies":[
{
"name":"John",
"content":"That's just my cat who ran over keyboard",
"replies":null
}
]
},
{
"name":"indy",
"content":"ok for me",
"replies":null
}
]
}

这样“评论”部分可以通过点击点(假设是一个圆圈)来填充,就像

d3.selectAll("circle") // data are already bind here providing the d.x and d.y values
.on("click",funtion(d){
d3.select("#node_where_I_want_the_comment_form")
.append("form") //... the user sets name and content
})

然后用名称和内容设置d.comment=。这并不简单,但我建议使用 https://www.mongodb.org/存储这种无模式数据。看:

http://docs.mongodb.org/ecosystem/use-cases/storing-comments/

关于d3.js - 将用户评论存储到 d3js 图表中的数据点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23417264/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com