score:1
Accepted answer
Instead of doing
myChart.transition().
attr("height", function (d) {
return yScale(d);
}).
attr("y", function (d) {
return(h-yScale(d));
})
The above is wrong since you are giving transition to svg.
Here myChart
is the SVG
.
You should be doing the same on the rectangle or the bars as shown below.
rects.transition().
attr("height", function (d) {
return yScale(d);
}).
attr("y", function (d) {
return(h-yScale(d));
})
working code here
Source: stackoverflow.com
Related Query
- Learning To Create Transition In D3.js Getting Error Svg Height & Y Is NAN
- Getting error on applying transition in d3
- Transition height onload of d3js rect svg
- Getting NaN values in svg path 'd' attr when trying to map geojson data
- Scale path to fit SVG height without blind trial and error
- d3 svg rect height becomes NaN
- d3 js pie chart is not showing even there is not error in web browser console. and SVG is getting append
- Auto width and height for SVG image
- Changing number displayed as svg text gradually, with D3 transition
- Making SVG container 100% width and height of parent container in D3 v4 (instead of by pixels)
- IE11 does not accept SVG height and width when using D3
- d3.js: Transition the colours in an SVG linear gradient?
- Getting expected attribute value in D3 transition
- getting error for d3-tip in angular2
- Using d3.js to create an SVG at several divs
- Expected ')' - SVG Transforms throwing error
- Getting transition values in D3
- SVG textPath not visible after transition on Chrome
- How to create SVG elements of different types based on data?
- How to maintain the SVG marker width and height ?
- I'm getting JavaScript error "d.getMonth is not a function" when trying to format a date using d3.time.format
- How can I get the natural width and height of an svg image element?
- D3: How to create slow transition of circle radii for nodes in force directed graphs?
- How do I create a minimap of an SVG using D3 v5 and show the current viewport dimensions?
- D3.js how to transition in opposite direction with basic SVG elements
- D3 Persistent Path d expected number error during transition
- viewBox attribute with svg height and width attributes set
- Dynamically create scrollable SVG
- How to create a flow layout in SVG using D3.js?
- Create a transition template for re-use
More Query from same tag
- D3 - Disable grouping
- Implementing D3FC-Sample for data reduction
- d3js Don't animate first enter
- Drawing a fixed-length circle in D3.js
- How to save the last state of sliders after page reload
- d3.js v4 stacked bar tooltip / hover (using modified d3-tip) offset issue
- D3 Data Visualisation aligning tick labels and rect
- How to update the index (i) on bound data in d3?
- Extending the axis bar height in d3 js charts
- Tooltip background color in d3 is only filling half
- (Angular 4) How to a Bind Global Touch Event Handler to Disable iOS Safari Page Drag?
- D3 Changing the width attribute of an object depending on it's child
- D3.js Line chart tooltip at points
- How to add filters effects to Svg in d3
- height should be of fixed size in responsive chart
- Label above d3 chart itself
- dc.js d3.js ElasticX with date values not rendering correctly when filtered
- Getting the ticks in d3 v4
- d3js does not enter into line function
- R2D3's QUnit tests fail out of the box - what am I doing wrong?
- dc.js - queries related to axis
- ReferenceError- crossfilter is not defined
- Uncaught Error: [$injector:modulerr] - Heatmap using d3 and AngularJS
- How can I zoom into this graph using D3v6
- Updating D3 zoom behavior from v3
- Identifying the function used in this d3 stacked bar chart example
- Arrow is not touching to nodes in d3.js tree view in mobile and touch screen
- When a d3.behavior.zoom event is triggered programatically, how do you set inital values for translate and scale?
- Trying to implement d3.js version 4 as a polymer component
- d3 bubble-chart react js: how to keep bubbles inside chart boundary?