Comments (3)
@pachamaltese @cnavarreteliz this feature had been added in v0.8.5. We are showing only the share percentage by default, as there is no way to know how to format the user's raw value (ie. could be dollars, could be weight, etc).
Each accessor function is provided 3 variables:
- the user's untouched data object
- the index of that data object in the user's data array
- the internal d3plus element containing calculated measures
The default behavior uses the tbody
property of the tooltip like so:
tbody: [
["Share", (d, i, x) => `${formatAbbreviate(x.share * 100, this._locale)}%`]
]
from d3plus-hierarchy.
Hi @davelandry
I was trying to mimic tooltips from version 1. How would you include the share without passing the sum object (i.e. not like this https://jsfiddle.net/0y9ku3vz/1/)?
I checked the source and here is my sketch:
function(d) {
var table = "<table class=\'tooltip-table\'>";
table += "<tr><td class=\'title\'>Value:</td><td class=\'data\'>" + d.value + "</td></tr>";
table += "<tr><td class=\'title\'>Share:</td><td class=\'data\'>" + Math.round((d.value / d.total) * 100) + "%" + "</td></tr>";
table += "</table>";
return table;
}
from d3plus-hierarchy.
@davelandry sounds good, my opinion is that d3plus 1 was amazing
if I had time I'd update its dependencies and prevent it from dying
from d3plus-hierarchy.
Related Issues (20)
- set ariaLabels on shapes
- Total in Donut/Pie chart behind chart's svg HOT 1
- pack visualization
- An in-range update of d3plus-dev is breaking the build 🚨 HOT 1
- allow text inside Donut chart
- multiple labels visible in nested Pack chart
- less agressive highlighting in treemaps HOT 1
- show pie chart labels by default
- thresholdByDepth function linting errors
- remove es6 arrow functions from examples
- "l" variable collision with user data
- set default treemap and pie legendSort method to use size
- pass locale to share percentage formatAbbreviate
- legend tooltips show N/A share percentage HOT 1
- dynamic depth in TreeMap HOT 2
- threshold does not apply for top-level groupBy HOT 1
- create advanced timeline example
- Treemap Combining Groups HOT 3
- create simple example of Tree and fix any bugs if they exist
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from d3plus-hierarchy.