Replace tooltip item xLabel and yLabel with label and value#5996
Replace tooltip item xLabel and yLabel with label and value#5996simonbrunel merged 6 commits intochartjs:masterfrom
Conversation
|
This comment is not directly related to your PR, which I haven't really reviewed yet, but just has me thinking about the subject generally. For 3.0 (or maybe before if we provided proper backwards compatibility), I wonder if we'd want to flip this concept in the other direction. E.g. for BarChart: The issue is that right now we need a horizontal version of every class to change the default scale options. E.g. if we want a horizontal line chart we need to swap the defaults so that x is the line axis and y is the category axis. I don't think you could have a |
simonbrunel
left a comment
There was a problem hiding this comment.
Looks good, but I thought we would be able to remove the special case in the category scale getLabelForIndex()?
|
You would need to update the docs too which currently reference But I think this change breaks backwards compatibility? |
Actually no, unless a
I don't think so - |
|
Should these rather be |
|
I don't understand why we can't remove the special case from the category scale, which one shouldn't care if it's an index or value scale since now the tooltip calls I also think that's a breaking change for user generating custom tooltip items. I think we should fallback to
+1, though that's the formatted value. |
Because if we have 2 labels and 100 data points, we need to know the label index for (for example) data point 20, and we actually have only the label as data, not its index.
I initially put it that way, but thought it might be useless and left those fallbacks out (its a lot prettier without. 😄 ).
At the moment it actually is not the formatted value (except for time scale). That should be generalized too. |
|
+1 to |
Time scale implements same thing. I think other scales should do that as well (probably why I think this aspect needs more work, but its not in the scope of this PR.
Original functionality restored as fallback. As a conversation starter added a |
I think that's a great idea but should be implemented as a separate PR. What about I would also move this option under the tooltip option in a first time, then add another one for the scale in a second time (or vice-versa). |
|
Conversation started, so removed "value formatting" from this PR. Will do another about that. |
|
Don't forget to update |
c668222 to
68b2fdb
Compare
|
Added minimal documentation. I don't think anything needs to be changed in |
|
You're right. Nevermind about |
|
@kurkle just a heads up, this PE will need to be rebased |
The move of
_getIndexScale()and_getValueScale()toDatasetController, enabled usage for tooltips.This again allows more generalized defaults and removal of overrides in
horizontalBar.