-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Implement percentage flags to control funnel hoverinfo and hovertemplete #3958
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,25 @@ | ||||||||
/** | ||||||||
* Copyright 2012-2019, Plotly, Inc. | ||||||||
* All rights reserved. | ||||||||
* | ||||||||
* This source code is licensed under the MIT license found in the | ||||||||
* LICENSE file in the root directory of this source tree. | ||||||||
*/ | ||||||||
|
||||||||
'use strict'; | ||||||||
|
||||||||
module.exports = function eventData(out, pt /* , trace, cd, pointNumber */) { | ||||||||
// standard cartesian event data | ||||||||
out.x = 'xVal' in pt ? pt.xVal : pt.x; | ||||||||
out.y = 'yVal' in pt ? pt.yVal : pt.y; | ||||||||
|
||||||||
// for funnel | ||||||||
if('percentInitial' in pt) out.percentInitial = pt.percentInitial; | ||||||||
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. here 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. is 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. Right now with formatting it is between 0-100. The raw ratios are between 0-1. 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. FYI - in case of 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. This is what pie does: plotly.js/src/traces/pie/plot.js Lines 365 to 367 in 3e3b22d
that is:
For example, Plotly.newPlot(gd, [{
type: 'pie',
labels: ['a', 'b', 'c'],
values: [1, 2, 3]
}]) shows 16.7%, 33.3% and 50% in the hover labels when But if |
||||||||
if('percentPrevious' in pt) out.percentPrevious = pt.percentPrevious; | ||||||||
if('percentTotal' in pt) out.percentTotal = pt.percentTotal; | ||||||||
etpinard marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
|
||||||||
if(pt.xa) out.xaxis = pt.xa; | ||||||||
if(pt.ya) out.yaxis = pt.ya; | ||||||||
|
||||||||
return out; | ||||||||
}; |
Uh oh!
There was an error while loading. Please reload this page.