1

I'm sure this was working yesterday and can't for the life of me work out what's changed.

I initialize a Rickshaw range slider with this code:

var preview = new Rickshaw.Graph.RangeSlider( {
graph: graph,
element: document.getElementById('preview'),
} );

But so long as those lines are present, I trigger this chain of errors (and my slider doesn't show up):

Uncaught TypeError: Cannot read property 'x' of undefined rickshaw.js:487
  (anonymous function) rickshaw.js:487
  dataDomain rickshaw.js:487
  Rickshaw.Graph.RangeSlider.Rickshaw.Class.create.build Rickshaw.Graph.RangeSlider.js:23
  Rickshaw.Graph.RangeSlider.Rickshaw.Class.create.initialize Rickshaw.Graph.RangeSlider.js:12
  klass rickshaw.js:182
  (anonymous function) chart:356

Based on my very limited JS knowledge it looks like it's hitting an issue when it tries to determine the min / max of the chart... which seems odd, given that the y-axis presumably does the same thing and it works fine. Any ideas what's going on?

You can see the code live here: http://azteccloud.com/chart

1 Answer 1

1

I was facing the same issue and after looking into the problem i have found the actual problem.

When you initialize "Rickshaw.Graph.RangeSlide", you should have your "Rickshaw.Graph" initialized with some series data. Even if you don't have any data yet. you can initialize it with 0. e.g

var seriesData = [{x:0,y:0}];

This will resolve your error. Thanks

Sign up to request clarification or add additional context in comments.

2 Comments

Nice! Thanks, this is perfect.
One more thing, in case of time on x-axis its initial value should be some time instead of 0.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.