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 8704223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:03:02+00:00 2026-06-13T03:03:02+00:00

I’m using d3 to build a visualisation which includes a modified version of the

  • 0

I’m using d3 to build a visualisation which includes a modified version of the calendar example:
http://mbostock.github.com/d3/ex/calendar.html.

enter image description here

I have turned my calendar by 90 degrees by changing the monthpath function:

function monthPath(t0) {
  var t1 = new Date(t0.getFullYear(), t0.getMonth() + 1, 0),
      d0 = +day(t0), w0 = +week(t0),
      d1 = +day(t1), w1 = +week(t1);
  return "M" + (d0) * z + "," + (w0 + 1) * z
      + "V" + w0 * z 
      + "H" + 7 * z
      + "V" + w1 * z 
      + "H" + (d1 + 1) * z
      + "V" + (w1 + 1) * z 
      + "H" + 0
      + "V" + (w0 + 1) * z 
      + "Z";
}

I would like to label the months, to the side of the calendar, at the start of each monthpath line. So I started by defining the month variable:

month = d3.time.format("%b"),

I am probably wrong but I am assuming I can insert my month variable into my monthpath function to print my labels? I’m trying to end up with a calendar similar to the one by Nathan Yau:
http://flowingdata.com/2012/01/11/vehicles-involved-in-fatal-crashes/

enter image description here

Any ideas?

thanks

  • 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-13T03:03:03+00:00Added an answer on June 13, 2026 at 3:03 am

    This should do the trick – insert after the svg.selectAll("path.month") block from the original example.

        var month_name = d3.time.format("%B")
    
    svg.selectAll("text.month")
        .data(function(d) { return d3.time.months(new Date(d, 0, 1), new Date(d + 1, 0, 1)); })
      .enter().append("text")
        .attr("class", "month")
        .attr("x", function(d) { return week(d) * cellSize; })
        .attr("y", 8 * cellSize)
        .text(month_name);
    

    You will also need to modify the margins to make room for the labels:

    var margin = {top: 19, right: 20, bottom: 40, left: 19},
        width = 960 - margin.right - margin.left, // width
        height = 156 - margin.top - margin.bottom, // height
        cellSize = 17; // cell size
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
i got an object with contents of html markup in it, for example: string
I have thousands of HTML files to process using Groovy/Java and I need to
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

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.