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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:35:18+00:00 2026-06-18T09:35:18+00:00

Resolved: Thanks, the tickValues gave me the wanted result. I used the values from

  • 0

Resolved:

Thanks, the tickValues gave me the wanted result. I used the values from d3.min and d3.max:

Result

    var xMin = d3.min(groups, function(c) { return d3.min(c.values, function(v) { return v.date; }); });
    var xMax = d3.max(groups, function (c) { return d3.max(c.values, function (v) { return v.date; }); });

    x.domain([xMin,xMax]);

        var xAxis = d3.svg.axis()
            .scale(x)
            .tickFormat(d3.time.format('%y-%m-%d'))
            .orient("bottom")
            .tickValues([xMin, xMax]);

Problem:

So I have a D3js multi-series line chart.

Chart

The X axis is bottom and is time (the range of this depends on the user selection, can be few days, weeks, months or years even).
The Y axis is value and is decimal.

What I have problem with is that the labels on the axis is overlapping and it’s looking rather poorly.

So my question is if there is a way to show only the first date on the axis and the last date?

I have based the chart on this one:
http://bl.ocks.org/3884955

My code for x-axis:

    var x = d3.time.scale().range([0, dimensions.width]);

    x.domain([
        d3.min(groups, function (c) { return d3.min(c.values, function (v) { return v.date; }); }),
        d3.max(groups, function (c) { return d3.max(c.values, function (v) { return v.date; }); })
    ]);

        var xAxis = d3.svg.axis()
            .scale(x)
            .tickFormat(d3.time.format('%a %d'))
            .orient("bottom")
            .ticks(5);

        svg.append("g")
            .attr("class", "x axis")
            .attr("transform", "translate(0," + dimensions.height + ")")
            .call(xAxis);
  • 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-18T09:35:19+00:00Added an answer on June 18, 2026 at 9:35 am

    Try adjusting the number of ticks with the ticks() function or, if that doesn’t produce the desired result, try setting the tick values explicitly with tickValues().

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

Sidebar

Related Questions

EDIT: this question is resolved thanks to a suggestion from @noShowP I am filling
Please Resolved this type Error for generating to debugging i-phone application. Thanks Anil
Thanks to this question/answer Automatic Reference Counting: Error with fast enumeration I resolved a
RESOLVED! THANKS EVERYONE. I need to search for duplicates - table as follows: id,
[RESOLVED] See below for question details. The line var maxUl = $(objUl+'[rel='+maxItems+']'); needs to
Resolved Thanks! I need to apply css to the current active menu (PARENT LIST
This question is a followup to a previous question , that was resolved thanks
UPDATE: NOW RESOLVED - Thanks everyone! Fix: I had a column named referred_by and
Ok. So here's a netbeans issue thanks to auto generated code from GUI designer.
EDIT: Resolved itself. Recreated the LoginController and issue is gone. Thanks for the responses!

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.