0

I am trying to make a demonstration using cubism. I have created a custom context.metric, similar to the random() function on the cubism homepage. This loads my data set and renders correctly, showing a new row each second.

What I want to do now is have the axis scale domain update as well, using the date column from my dataset. For the purposes of demonstration, I want each second that passes in wall-time to correspond to one row in my dataset, which is hourly. I can set the scale domain when I create the context, but I cannot get it to update when new data is fetched.

I have tried to listen for context events such as change, and beforechange and manually update the domain there. It does not seem to work, or I am doing something wrong. Any suggestions would be greatly appreciated.

Thanks for the awesome libraries!

Scott
  • 590
  • 4
  • 13

1 Answers1

1

The context's time domain is fixed by the context step and size. For example, if you have a step of ten seconds and a size of 1,440, then the domain is the last four hours. If you use context.axis to display the axis, it will update automatically whenever the context fires a change event; you don't have to do anything. Cubism is designed for realtime dashboards, so it doesn't support advancing an hour per second.

mbostock
  • 51,423
  • 13
  • 175
  • 129
  • Thanks for the fast reply. I understand I am trying to do something outside of the cubism model... still was hoping it would be possible to accomplish by manually modifying the scale domain. Thanks again. – Scott May 15 '12 at 17:27
  • I think you could do that, but you'd want to change the context implementation, not the axis. – mbostock May 15 '12 at 17:35