Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8184825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:38:26+00:00 2026-06-07T01:38:26+00:00

I am trying to create an animated bar graph using d3.js. I want the

  • 0

I am trying to create an animated bar graph using d3.js. I want the bars to appear one by one like this example http://nvd3.com/ghpages/multiBar.html . I was able to create a similar behavior but the motion starts from the height of the bar builds the bar towards the x-axis, however I want the motion to start from the x-axis and go to the height of the bar like the example.

Much simplified version of my code:
http://jsfiddle.net/gorkem/ECRMd/

Any help would be much appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T01:38:27+00:00Added an answer on June 7, 2026 at 1:38 am

    Because the origin of the coordinate system is from the top-left, the ‘y’ value is anchored at the top of each bar. If the ‘y’ value is fixed, and the ‘height’ is increased, it looks like the bars grow down. In order to make the bars grow from the bottom, you’ll need to transition both the ‘y’ and the ‘height’ at the same time.

    This should be what you’re looking for, I’ve only changed two lines.

    chart.selectAll("rect")
     .data(data)
     .enter().append("rect")
     .attr("x", function(d, i) { return x(i) - .5; })
     .attr("y", function(d) { return h - .5; })                  //new----
     .attr("width", w)
     .transition().delay(function (d,i){ return i * 300;})
     .duration(300)
     .attr("height", function(d) { return y(d.value); })
     .attr("y", function(d) { return h - y(d.value) - .5; });    //new-----
    

    I’ve started the ‘y’ value at the bottom of the chart (h – 0.5). Then when you transition, you increase the ‘height’ (y(d.value)) and decrease the ‘y’ (h – y(d.value)) at the same rate. This has the effect of fixing the bottom of the bar to the axis.

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I am trying to create an animated bar graph using apple core animation.
I am trying to create an animated barchart by scaling the bar (slider) and
I'm trying to create a button which displays animated images. I read in this
I'm trying to create an animated UIImageView with certain image constraints. I want the
I am trying to create a simple and animated pie chart using CAShapeLayer .
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
Ok so I am trying create a login script, here I am using PHP5
Trying to create a background-image slideshow and am getting this error... This is the
I´m trying to create something like an own adBanner for a website in my
I'm trying to create a JPG from part of my WPF Applications. Like a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.