shutterstock / rickshaw

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

Rickshaw.Graph.RangeSlider.Preview should respect graph's renderer on creation #364

Closed andig closed 10 years ago

andig commented 10 years ago

All said. For now, preview.renderer is always 'area' until graph is reconfigured.

andig commented 10 years ago

simple but hacky fix for buildGraph function:

renderer: self.graphs[0].renderer.__proto__.name
rgilman commented 10 years ago

I found the same issue when I start with the 'line' renderer -- the preview is nevertheless 'area'. My workaround is to put

graph.configure({renderer:'line'});
graph.render;

towards the end of my drawChart function. It works, but is a hack. This issue needs a real fix.

fbordignon commented 10 years ago

My suggestion, I don't know if if will work with different renderers in the same graph Same buildGraph function on RangeSlider.Preview.js line 94:


            var graph = new Rickshaw.Graph(graphArgs);
            var ggrenderer = parent.renderer;
            ggrenderer.graph = graph;
            graph.renderer = ggrenderer;
            self.previews.push(graph);
ndbroadbent commented 10 years ago

@andig, thanks, your hacky fix worked for me!

alexandraorth commented 10 years ago

I'm still having this issue; is there anything that I need to do to make the preview render in the same way as the graph, or should this automatically happen?

hiro-su commented 10 years ago

Me, too.

hiro-su commented 10 years ago

This problem has been fixed in the latest code.

https://github.com/shutterstock/rickshaw/blob/master/src/js/Rickshaw.Graph.RangeSlider.Preview.js

<script src="js/rickshaw.min.js"></script>
<script src="js/Rickshaw.Graph.RangeSlider.Preview.js"></script>
jpiles commented 10 years ago

I had an issue while trying to do a multi-renderer with non-stacked areas. To make it work, I had to add also

unstack: parent.renderer.unstack

in line 99-100. I think that the more general issue is that it doesn't make a deep clone of all of the parent's configuration. There could be more options missing...