shutterstock / rickshaw

JavaScript toolkit for creating interactive real-time graphs
https://shutterstock.github.io/rickshaw
MIT License
6.53k stars 941 forks source link

Can I do a sparkline? #124

Closed mzupan closed 12 years ago

mzupan commented 12 years ago

I'm trying to emulate a sparkline and the graph seems to be pulled up to the top.. See the image for an example

http://snapplr.com/bhd8

My graph to create it looks something like

graphs[id]['graph'] = new Rickshaw.Graph({
                            element: document.querySelector('#'+ id),
                            width: $(this).find('input.width').val(),
                            height: $(this).find('input.height').val(),
                            renderer: 'line',
                            series: graphs[id]['series']
                        });

It fills the full height of that box and I can see this in chrome dev tools also.

Jellyfrog commented 12 years ago

If you can provide a working test-case on http://jsbin.com its easier to help!

mzupan commented 12 years ago

http://jsbin.com/welcome/23013/edit

It seems to happen only when the y data is tight together from my tests.

Jellyfrog commented 12 years ago

Rickshaw seems a bit...heavy...for that task, but Im sure its possible some way. Maybe one of these can help tho; http://benpickles.github.com/peity/ http://mbostock.github.com/protovis/ex/sparklines.html http://willarson.com/code/sparklines/sparklines.html http://omnipotent.net/jquery.sparkline/

dchester commented 12 years ago

Hi, if you specify min: 'auto', then the range of the values will fill the height of the graph. Does that do what you want?

mzupan commented 12 years ago

@dchester thanks that did the trick