[英]d3js: time scaling and winter months
I'm working on a scatter plot in d3js which isolates winter months. 我正在d3js中绘制一个散点图,该图可以隔离冬季。 Is there a quick and easy way to format the x scale such that I do not have a gap in the graph from March to December? 有没有一种快速简便的方法来格式化x比例,以便在三月到十二月之间我在图表中没有空隙? I'd prefer the x axis to range from December 21 to March 21: 我希望x轴的范围是从12月21日到3月21日:
1901 example http://lmnts.lmnarchitects.com/wp-content/uploads/2014/04/2014-04-01-09_31_30-127.0.0.1_8020_Climate3_seattle-winter-temps.html.jpg 1901示例http://lmnts.lmnarchitects.com/wp-content/uploads/2014/04/2014-04-01-09_31_30-127.0.0.1_8020_Climate3_seattle-winter-temps.html.jpg
You can extend your dates to have a year, even if you don't want it shown, assigning the months after July the previous year than the months of the first semester: 您可以将日期延长为一年,即使您不希望显示该日期,也可以将前一年的七月之后的月份分配给第一学期的月份:
var data = [
{date: '2012/12/01', RH: 50, ...},
{date: '2012/12/02', RH: 55, ...},
...
{date: '2013/03/31', RH: 89, ...}
];
And use d3.extent
to set the extents of the date scale. 并使用d3.extent
设置日期范围的范围。 The axis should show a continuous interval between December to March. 该轴应显示从12月到3月的连续间隔。 Regards, 问候,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.