0

It is different from referred issue. How to rest zoom in Ordinal Scale in D3js

Here is Zoom code

function zoomed() {
            svg.select(".allStates").attr("transform", "translate(" + d3.event.translate[0]+",0)scale(" + d3.event.scale + ",1)");
            svg.select(".x.axis").attr("transform", "translate(" + d3.event.translate[0]+","+(height)+")").call(xAxis.scale(x0.rangeRoundBands([0, width * d3.event.scale],.5 * d3.event.scale)));
            svg.select(".y.axis").call(yAxis);
            }

How do I reset the scale ?

Hi friends

i got one solution for rest

svg.select(".allStates").attr("transform", "translate(0,0)","scale","(0,0)");
            svg.select(".x.axis").attr("transform", "translate(0,450)").call(xAxis.scale(x.rangeRoundBands([0, width],.1)));
            svg.select(".y.axis").call(yAxis);

But after rest when i move on the pan the svg chart will be be in zoom state ...can you plese sugest on this

Thank you

  • see this:http://stackoverflow.com/questions/8681607/how-do-i-specify-the-initial-zoom-level-in-d3 – Suchit kumar Apr 28 '16 at 05:49
  • 1
    Possible duplicate of [Is there a way to zoom into a D3 force layout graph?](http://stackoverflow.com/questions/7871425/is-there-a-way-to-zoom-into-a-d3-force-layout-graph) – Willie Cheng Apr 28 '16 at 06:57

0 Answers0