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

Tickformat attribute descriptions should link to d3 v3 timeformat docs #3052

Closed
fsmeier opened this issue Sep 26, 2018 · 10 comments
Closed

Tickformat attribute descriptions should link to d3 v3 timeformat docs #3052

fsmeier opened this issue Sep 26, 2018 · 10 comments
Assignees

Comments

@fsmeier
Copy link

fsmeier commented Sep 26, 2018

Tickformat with "%V" for weekdays is not working:
https://codepen.io/anon/pen/NLQpEz

It should work as described in https://github.com/d3/d3-time-format/blob/master/README.md#locale_format

Where is the source of the formatting? Can anyone provide a link pls?

All the best

@etpinard
Copy link
Contributor

We're (still unfortunately) using d3 v3. So that doc page isn't adequate. We should update the tickformat descriptions:

description: [
'Sets the tick label formatting rule using d3 formatting mini-languages',
'which are very similar to those in Python. For numbers, see:',
'https://github.com/d3/d3-format/blob/master/README.md#locale_format',
'And for dates see:',
'https://github.com/d3/d3-time-format/blob/master/README.md#locale_format',
'We add one item to d3\'s date formatter: *%{n}f* for fractional seconds',
'with n digits. For example, *2016-10-13 09:15:23.456* with tickformat',
'*%H~%M~%S.%2f* would display *09~15~23.46*'
].join(' ')

and link it to

https://github.com/d3/d3-3.x-api-reference/blob/master/Time-Formatting.md#format

#424 is the issue regarding bumping d3.

Thanks for reporting.

@etpinard etpinard changed the title Tickformat for weekdays is not working Tickformat attribute descriptions should like to d3 v3 timeformat docs Sep 26, 2018
@etpinard etpinard changed the title Tickformat attribute descriptions should like to d3 v3 timeformat docs Tickformat attribute descriptions should link to d3 v3 timeformat docs Sep 26, 2018
@alexcjohnson
Copy link
Collaborator

For completeness, the items d3v3 is missing that v5 has are:

%Q - milliseconds since UNIX epoch.

%s - seconds since UNIX epoch.

%u - Monday-based (ISO 8601) weekday as a decimal number [1,7].

%V - ISO 8601 week of the year as a decimal number [01, 53].

%f - microseconds as a decimal number [000000, 999999]. Frustratingly, d3 did something different than we did with %f, which we added (before it was part of d3) to support more digits and increased flexibility over %L. They added it as a fixed 6 digits of precision, whereas we support any precision up to 6 digits (using %{n}f) and we truncate trailing zeros. The fixed precision of only 3 (%L) or 6 digits is, IMO, a significant limitation (though I can see wanting to keep trailing zeros, we could easily add that) so I guess we'll be keeping this particular difference from D3 long-term...

Perhaps not worth it until we upgrade our d3, but it would be possible for us to add Q,s,u,V similarly to how we added f.

@etpinard
Copy link
Contributor

Frustratingly, d3 did something different than we did with %f,
but it would be possible for us to add Q,s,u,V similarly to how we added f.

Ha good point, I forgot about that %f discrepancy. Thanks for the reminder!

@cooperok
Copy link

cooperok commented Oct 9, 2018

It will be greate to also add %{n}f in documentation. Becasuse there is nothing about truncating trailing zeroes, however in provided link in d3-format version 1.3.0 has been added ~ operator for that purpose. I thought that there is no any option to truncate trailing zeroes but found this issue

@ppKrauss
Copy link

Hi, about the @etpinard's comment "We're (still unfortunately) using d3 v3": there are plans for update Plotly's D3 in 2019?

@etpinard
Copy link
Contributor

there are plans for update Plotly's D3 in 2019?

You subscribed to #424 for the most up-to-date development info.


We for sure would like to upgrade d3 in the near future, but upgrading currently breaks our transition/animation code which (unfortunately) has a lot of not-so-well tested behavior and would require many days of manual testing. As newer major versions of d3 don't offer many new features of interest for us, we haven't gotten around to do it.

@Danussie
Copy link

Is there any progress with this issue? I have the same issue, %w is ok but %V is outputting simply a "V", not the ISO week number.

        fig.update_layout(
            hoverlabel=dict(
                bgcolor="white",
                font_size=16,
                font_family="Rockwell"
            ),
            height=700,
            font=dict(
                size=16
            ),
            xaxis_tickformat = 'CW %V-%Y'
        )

Output:
image

@nicolaskruchten
Copy link
Member

We've implemented this and it should be out in the next version of Plotly.js, in the coming days.

@Danussie
Copy link

Danussie commented Sep 7, 2020

We've implemented this and it should be out in the next version of Plotly.js, in the coming days.

Hi @nicolaskruchten - when do you plan to release the next version?

@nicolaskruchten
Copy link
Member

Plotly.js version 1.55 came out last Thursday, and it supports %V

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

No branches or pull requests

7 participants