cubism metrics aren't shifting on a call to .shift(offset)

13 views
Skip to first unread message

Bae25

unread,
Apr 15, 2014, 10:08:44 PM4/15/14
to d3...@googlegroups.com
I'm experimenting with cubism and all's going well except that I'm unable to make the simple shift method work. I've looked into the code 
for cubism.v1.js and there's nothing to the shift except the addition of an offset, so I don't understand why it's not working. 

I've tried to really simplify things with the data coming from a csv file and there's no shift there either: http://bl.ocks.org/bae25/10797393. I expected the third horizon to be shifted by 30 
days from the BIDU time series.


Thinking the problem was something to do with the fact that the data aren't being updated, I tried it with updated randomly created data, visible at http://bl.ocks.org/bae25/10795022, also based on one of the examples. 

The 6th horizon is supposed to be shifted by 30 minutes from the 5th horizon but it isn't shifted at all. Here's the relevant bit of code (where the function random generates the metrics): 

var Data = d3.range(1,6).map(random);
var primary = Data[4];
var secondary = primary.shift(-30*60*1000); 
Data[5] = secondary;

d3.select("#demo")
    .selectAll(".horizon")
   .data(Data) 


What am I not understanding?

Also, why isn't the title appearing properly? Should I be doing something other than secondary = primary.shift(offset) to properly create a shifted metric?

Apologies for any formatting difficulties with my gists. 

Thanks so much for any advice. 

Bae


Bae25

unread,
Apr 15, 2014, 10:16:08 PM4/15/14
to d3...@googlegroups.com
I want to add.... often with my server data, I actually "undefined" when I try to call secondary.valueAt(ind).... 

So... basically, I'm really lost with shift. 
Reply all
Reply to author
Forward
0 new messages