Search code examples
d3.jscubism.js

Extend data to extent of graph


I have time-sensitive data that ranges from now until 7 days from now with hourly resolution ~220 values. I was able to get them to plot following Mike Bostock's demo here: http://bost.ocks.org/mike/cubism/intro/demo-stocks.html

but I can't seem to find how to extend the timescales and data to span across the entire display. I was looking for an extent argument or xrange or width, but I haven't had any luck. I'm sure the answer is trivial, but I can't seem to find it.

Horizon test plot

var context = cubism.context()
.step(3600000) // <-- this changes the time resolution
.size(1280) // <-- this changes the width
.stop();

Also, d3.time.scale.domain seems to be undefined in d3.v3.min.js.

Here's the fiddle that shows you what the code looks like (because it's calling d3.csv I wasn't sure how to get it completely working in the fiddle...so I included the csv file below the javascript.) : http://jsfiddle.net/oay7tvq0/


Solution

  • I think that cubism uses a single pixel for each time slice, so if you've only got 220 timesteps only 220 pixels are needed. Check the documentation to be sure. If I'm correct then you'll either have to be creative with your timeseries and extend the timestep (by repeating adjacent records) or perhaps d3 (or one of the various libraries built on it) would better suit your purposes. – user1614080

    This I'm sure is the answer...