简体   繁体   English

dc.js气泡图,沿x轴时间线绘制气泡

[英]dc.js Bubble Chart, plotting bubbles along the x-axis timeline

I am building a bubble chart in dc.js but am having problems with plotting along the X-axis. 我正在dc.js中构建气泡图,但在沿X轴绘图时遇到问题。

The link to the graphs is: http://junklogic.com/dcjs/creatures/creatures.html 图形的链接是: http : //junklogic.com/dcjs/creatures/creatures.html

The design of this chart is as follows, using a dataset of "Mythical Creature Sightings" for fun. 该图表的设计如下,使用“神话生物目击事件”数据集进行娱乐。

Each line of JSON is like this: JSON的每一行都是这样的:

{
  "creature_name": "Dragon",
  "seenby": "Ann",
  "date": "2014-01-25T22:10:58",
  "danger": 3,
  "location": "FL" 
},

Each bubble is grouped based on the date and time of the creature sightings. 每个气泡根据发现生物的日期和时间进行分组。

  • The bubble radius is the count of sightings by an individual at that particular time. 气泡半径是个人在特定时间的目击次数。
  • The bubble color is an average of the danger levels, summed and divided by count to reveal a number 1-3 气泡颜色是危险等级的平均值,将其相加并除以计数即可得出数字1-3
  • The y-axis is a calculation of the danger levels multiplied by the count (I call this "impact") y轴是对危险等级乘以计数的计算(我称之为“影响”)
  • The x-axis should plot the bubbles based on the timeline, with the same time range as the bar chart below it. x轴根据时间线绘制气泡,其时间范围与其下方的条形图相同。 This is where I am stuck. 这就是我卡住的地方。

All the bubbles are pinned at pixel 0 and dont plot across. 所有气泡都固定在像素0处,并且不会划过。 I would like these to reflect their point across the timeline. 我希望这些能够反映他们在整个时间表中的观点。 Ideally, I'd like to group them into, say, 1-hour groups. 理想情况下,我想将它们分为1小时的小组。 But just getting them to plot will make a big difference in my progression of learning these libraries. 但是,仅让他们绘图将对我学习这些库的过程产生很大的影响。

The script is at: http://junklogic.com/dcjs/creatures/js/creatures.js 该脚本位于: http : //junklogic.com/dcjs/creatures/js/creatures.js

The JSON file is at: http://junklogic.com/dcjs/creatures/data/dashdata.json JSON文件位于: http : //junklogic.com/dcjs/creatures/data/dashdata.json

Thanks in advance for any help. 在此先感谢您的帮助。 If I need to provide any other info to help solve this question, I'm happy to provide what I can 如果我需要提供任何其他信息来帮助解决此问题,我很乐意提供

Well, I found it. 好吧,我找到了。

p.datetime += v.date; 

and

p.datetime -= v.date;

should just be: 应该只是:

p.datetime = v.date;

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

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