Giter Club home page Giter Club logo

Comments (3)

davelandry avatar davelandry commented on August 20, 2024 2

@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:

  1. the user's untouched data object
  2. the index of that data object in the user's data array
  3. 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.

pachadotdev avatar pachadotdev commented on August 20, 2024

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.

pachadotdev avatar pachadotdev commented on August 20, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.