question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`axisBottom.tickValues` does not respect string interval when crossing end of month boundaries

See original GitHub issue

Describe/explain the bug I’m running into a strange issue with using intervals in tickValues (every 3 days, every 7 days, etc). When the data moves past the end of the month, the tickValue interval is thrown off. As you can see in the screenshot, both 07/31 and 08/1 ticks are shown next to each other and does not hold up to the every 3 days interval.

image

To Reproduce

  1. Use a line chart that uses a time series for the X Axis
  2. Use a dataset that crosses over the end of a month (i.e. 07-29-2020 through 08-08-2020)
  3. Use a tickValues interval of “every 3 days”, “every 7 days”, etc

Reproduced in this code sandbox: https://codesandbox.io/s/brave-brown-9qd33

Expected behavior I would expect the X-Axis to understand the end of the month and continue its interval of three days (or whatever the interval is). In my example, the X-Axis would look like this:

image

To get around this for now, I was able to manually assign x-axis tick values: https://codesandbox.io/s/cocky-firefly-tekbg I’ll likely just create these tick values based on my data set and then format my dates via a function in axisBottom.format.

Desktop (please complete the following information):

  • OS: MacOS Catalina 10.15.6
  • Browser: Chrome
  • Version: 84.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
fillippeytoncommented, Aug 28, 2020

Looks like an issue based on the usage of d3.ticks with d3.timeDay.every(n)

http://jsfiddle.net/myqhpogs/

var x = d3.scaleTime()
    .domain([new Date('2020-08-28'), new Date('2020-09-13')]);

console.log(x.ticks(d3.timeDay.every(5)));

// result
[
  0: Mon Aug 31 2020 00:00:00 GMT-0700 (Pacific Daylight Time) {},
  1: Tue Sep 01 2020 00:00:00 GMT-0700 (Pacific Daylight Time) {},
  2: Sun Sep 06 2020 00:00:00 GMT-0700 (Pacific Daylight Time) {},
  3: Fri Sep 11 2020 00:00:00 GMT-0700 (Pacific Daylight Time) {},
]
0reactions
fillippeytoncommented, Mar 28, 2021

bump

On Sun, Mar 28, 2021 at 2:48 PM stale[bot] @.***> wrote:

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, “bump”), and we’ll keep it open. We are sorry that we haven’t been able to prioritize it yet. If you have any new additional information, please include it with your comment!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/plouc/nivo/issues/1101#issuecomment-808964586, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7P52PXKYIO2HCFIXF7NE3TF6P3HANCNFSM4P7TOPRQ .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does my d3 chart's x-axis include the first of every month ...
Try const tickAmount = d3.timeWeek.every(1); instead: Note that for some intervals, the resulting dates may not be uniformly-spaced; d3.
Read more >
Read D3 Tips and Tricks v4.x | Leanpub
Then how to make the axis labels larger, change the tick size, make the lines fatter, change the colour, add a label, fill...
Read more >
D3 Axes - D3 in Depth
How to create chart axes using D3's axis module. This article covers axis orientation, transitions, number of ticks, custom tick values, tick formatting...
Read more >
Axis customization in Flutter Cartesian Charts - Syncfusion
Axis labels and ticks can be positioned inside or outside the chart area by using ... and will not work if you set...
Read more >
Customizing Matplotlib with style sheets and rcParams
Runtime rc settings#. You can dynamically change the default rc (runtime configuration) settings in a python script or interactively from the python shell....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found