forio / contour

Apache License 2.0
120 stars 21 forks source link

Tooltip shows incorrect text on scatter plots with similar points #294

Open lukwallace opened 5 years ago

lukwallace commented 5 years ago

Only occurs for charts with points that have the same X and Y values (but differing Z). The tooltip calls a findOriginalDataPoint function which finds the first point that has the matching x and y, and uses that point to generate the tooltip text message; points with the same x and y values but different Z, or other values will not be correctly picked up.

Snippet from contour.js

            function findOriginalDataPoint(d) {
                var res = [];
                _.each(data, function(series, seriesIndex) {
                    var name = series.name;
                    _.each(series.data, function(point) {
                        if (point.x === d.x && d.y === point.y) {
                            res.push(_.extend(point, {
                                series: name,
                                seriesIndex: seriesIndex
                            }));
                        }
                    });
                });
                return res;
            }