Conversation
|
I’m not sure about [1000, 3000] vs. [0, 9999] vs. [1500, 2500] as I used in this PR. The smaller heuristic avoided what I saw as an undesirable change to the |
|
I'm not seeing a clear-cut mathematical definition of what is best on this feature. The status quo feels bad, but we don't want to upset it too much either. This approach seems fine as it will do the right thing in most cases (for ticks). I wanted to do it for tips, too, but that could be a follow-up. We need to document it. |
|
We should do this for an ordinal scale, too… I’ll keep working. |
|
How’s this @Fil? |
|
(I thought about adding some documentation to the tip mark, but I don’t think it’s necessary as we don’t need to provide a complete specification of the “default format”.) |
| ``` | ||
| ::: | ||
|
|
||
| If the tick values are all integers between 1,500 and 2,500 (inclusive), Plot assumes the values represent years and formats ticks by default without thousand separators, such as 1996 instead of 1,996. You can explicitly suppress thousand separators with `tickFormat: "d"`, or enable them with `tickFormat: ",d"`. <VersionBadge pr="2403" /> |
There was a problem hiding this comment.
Upon re-reading "Plot assumes the values represent years" is a bit of an exaggeration. That assumption does not lead Plot to do anything more than setting the format. A more modest and accurate description could be:
If the tick values are all integers between 1,500 and 2,500 (inclusive), Plot formats ticks by default without thousand separators, such as 1996 instead of 1,996 — better when the values represent years.
I'm happy to merge with the "assumes" wording, though.
Alternative to #2395. Fixes #768.