Skip to content

Axis year strings being reformatted as numbers and interpolated #135

@tlrdstd

Description

@tlrdstd

Maybe I'm just nuts, but I can't figure this out. When I pass an array of stringified years as data to Plotly, it interpolates the strings as numbers:

http://codepen.io/anon/pen/RrayBx

Note that it shows my years as "2013", but then interpolates them as "2,013.5". Ugh.

It seems likely that tickformat could help me here, but I've looked at https://github.com/mbostock/d3/wiki/Formatting#numbers and https://docs.python.org/release/3.1.3/library/string.html#formatspec and none of those options seem to help. They change the value, but nothing fixes it for real.

IF I have multiple years ['2014', '2015'], then setting tickformat: 'd' "works". That feels like a violation of the spirit of what I want, though: a year is not a decimal number, it's a string. And I'm passing it in as a string, not a decimal number.

And perhaps a related bug: with only one year tickformat: 'd' doesn't work either. It hides the label entirely:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions