Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2k
Histogram events & bin hover label improvements#2113
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
59b64636dc9904ccf1a761b356d28f8add176860968d36d81a7e2f326b74fbeb91d1cbad0e08f6cb4e71758156751ad8c23aa03f7cc454dc2696c1c0331a16File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -28,6 +28,7 @@ var ONEHOUR = constants.ONEHOUR; | ||
| var ONEMIN = constants.ONEMIN; | ||
| var ONESEC = constants.ONESEC; | ||
| var MINUS_SIGN = constants.MINUS_SIGN; | ||
| var BADNUM = constants.BADNUM; | ||
| var MID_SHIFT = require('../../constants/alignment').MID_SHIFT; | ||
| @@ -1216,12 +1217,28 @@ axes.tickText = function(ax, x, hover) { | ||
| return out; | ||
| }; | ||
| axes.hoverLabelText = function(ax, val) { | ||
| /** | ||
| * create text for a hover label on this axis, with special handling of | ||
| * log axes (where negative values can't be displayed but can appear in hover text) | ||
| * | ||
| * @param {object} ax: the axis to format text for | ||
| * @param {number} val: calcdata value to format | ||
| * @param {Optional(number)} val2: a second value to display | ||
| * | ||
| * @returns {string} `val` formatted as a string appropriate to this axis, or | ||
| * `val` and `val2` as a range (ie '<val> - <val2>') if `val2` is provided and | ||
| * it's different from `val`. | ||
| */ | ||
| axes.hoverLabelText = function(ax, val, val2) { | ||
| if(val2 !== BADNUM && val2 !== val) { | ||
| return axes.hoverLabelText(ax, val) + ' - ' + axes.hoverLabelText(ax, val2); | ||
| } | ||
| var logOffScale = (ax.type === 'log' && val <= 0); | ||
| var tx = axes.tickText(ax, ax.c2l(logOffScale ? -val : val), 'hover').text; | ||
| if(logOffScale) { | ||
| return val === 0 ? '0' : '-' + tx; | ||
| return val === 0 ? '0' : MINUS_SIGN + tx; | ||
CollaboratorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. been around for a while, using regular dash instead of unicode minus. tested in 3aa03f7#diff-846cf5b534aa0d22bdd1da2b43ac3cbaR517 Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was wondering about that. Thanks 👌 | ||
| } | ||
| // TODO: should we do something special if the axis calendar and | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little surprised that this hadn't come up before (other than the test below that was actually wrong before), and obviously it's a bit questionable exactly what small fraction to put here... but if we just use straight
<vs<=etc it's pretty easy to trickfindBinon the edges.