d3.js - D3 Redraw Y-axes dynamically -


I want to create a dynamic graph with multiple (linear) axes. After the axes have been pulled, I would like to change the data domain and update / update the axes (comes as new data). Can I select existing axis with D3 and do this or do I have to explicitly save each axis in my code? I hope my question is not confused.

  // init all Y-axis $ .each (chart.YAxes, function {index}, {var yScale, yAxis; yScale = d3.scale.linear (). Ranges ([charthead, 0]); yScale.domain ([this.YMin, this.YMax]); yAxis = d3.svg.axis () .scale (yScale). Stamps (10, this.Title) .orient ("left"); D3Chart.append ("g") .attr ("class", "yAxis" + "y" + this.ID) .col yaxis; ...... // update y-axis After) my myAxis = d3.select (". Y" + yAxis.ID); var myScale = myYxis. ** // mill scale ?? ** myScale.domain ([newYMin, newimax]); D3 chart. Sect (".Y" + yAxis.ID) .transition () .duration (300) .bis ("sin-in-out") .col (myyaxis);  

thx. ..!

You have to keep the references of the axis object so that you can call me I will again select that DOM element and call it that will not work. There are so many examples for example, inside.


Comments