PMSI-AlignAlytics / dimple

An object-oriented API for business analytics
Other
2.73k stars 556 forks source link

d3 version 7.8.0 support #299

Closed moertchen closed 1 year ago

moertchen commented 1 year ago

Hi all,

we must upgrade d3 to from version 4.3.0 to version 7.8.0. We are currently using D3 in 4 tools. In one tool we are using dimple v2.3.0 and it is doing great. Unfortunately with the new d3 v7x and dimple v2.3.0 the following code is not working any more:

` this.getTooltipText = function (e) {

        var rows = [];

        // Add the series categories
        if (this.categoryFields !== null && this.categoryFields !== undefined && this.categoryFields.length > 0) {

            this.categoryFields.forEach(function (c, i) {

                if (c !== null && c !== undefined && e.aggField[i] !== null && e.aggField[i] !== undefined) {

                    // If the category name and value match don't display the category name
                    rows.push(c + (e.aggField[i] !== c ? ": " + e.aggField[i] : ""));

                }

            }, this);

        }

`

Variable e is now containing a mouse event so e.aggField is undefined.

It would be great if you could help - thank you & greetings :)

moertchen commented 1 year ago

ok issue is resolved - I had to write my own getTooltipTextLines() function which overrides the original function of dimple. I although had to override d like this:

   function getTooltipTextLines(containerId)

   {

       return function (d) {

           var tooltipLines = [];

           var d = d['srcElement']['__data__'];

                if (d.aggField[0] === 'Bad') {

              ...

          }

}