Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong x-values for year-week timeseries chart for some "singular" years #2676

Open
gibbopotam opened this issue Aug 9, 2019 · 2 comments
Open

Comments

@gibbopotam
Copy link

  • C3 version: 0.7.4
  • D3 version: 5.8.2
  • Browser: Google Chrome 76.0.3809.100 (Official Build) (64-bit)
  • OS: macOS, 10.13.6

Expected behavior:
Screen Shot 2019-08-09 at 11 05 13 AM

The same chart but the year is changed to 2018:
Screen Shot 2019-08-09 at 11 05 53 AM
As one can see the data points moved one week earlier on the chart. There're other "singular" years when this happens: 2007, 2024, 2029, 2035, ...

This is also seen on an older version of C3: 0.4.14

The code used (for convenience):

var chart = c3.generate({
    data: {
        x: 'x',
        xFormat: '%Y-%W',
        columns: [
            ['x', '2018-2', '2018-3', '2018-4'],
            ['data1', 1, 2, 3],
        ]
    },
    axis: {
        x: {
            type: 'timeseries',
            tick: {
                format: '%Y-%W'
            }
        }
    }
});
@panthony
Copy link
Contributor

panthony commented Aug 14, 2019

@gibbopotam Not sure if this is the cause but be careful with %Y-%W has it may be invalid.

I don't know the notation using d3 but for exemple with moment we are talking about Week year and it has a different notation.

  • gggg for week year
  • GGGG for ISO week year

Which is different than YYYY and it may yield different result.

@gibbopotam
Copy link
Author

@panthony Yeah, it looks like the use of %W isn't documented though present in d3 (where both %w and %W are present but c3 rejects %w altogether). Still nice to have, and it works almost fine save those singular years.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants