]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fixed label callbacks adding only a single line instead of multiple lines as stated...
authorRobert Becker <robert@rbecker.eu>
Thu, 4 Feb 2016 09:34:29 +0000 (10:34 +0100)
committerRobert Becker <robert@rbecker.eu>
Thu, 4 Feb 2016 09:34:29 +0000 (10:34 +0100)
src/core/core.helpers.js
src/core/core.tooltip.js

index 08fc3a419053b4bb1e6c29cad1a1da72c2e87849..b2369476429b6c8ffc806b64980e61aae1f53afa 100644 (file)
                isDatasetVisible = helpers.isDatasetVisible = function(dataset) {
                        return !dataset.hidden;
                };
+        isDatasetVisible = helpers.pushAllIfDefined = function(element, array) {
+            if (typeof element == "undefined") {
+                return;
+            }
+            
+            if (isArray(element)) {
+                array.push.apply(array, element);
+            } else {
+                array.push(element);
+            }
+               };
 }).call(this);
index 2ce84a91dbb093217a52993ebf72922b4092a40c..8ae52854ec8d809c60dc686940330128370663cb 100644 (file)
                        var lines = [];
 
                        helpers.each(tooltipItems, function(bodyItem) {
-                               var beforeLabel = this._options.tooltips.callbacks.beforeLabel.call(this, bodyItem, data) || '';
-                               var bodyLabel = this._options.tooltips.callbacks.label.call(this, bodyItem, data) || '';
-                               var afterLabel = this._options.tooltips.callbacks.afterLabel.call(this, bodyItem, data) || '';
-
-                               lines.push(beforeLabel + bodyLabel + afterLabel);
+                helpers.pushAllIfDefined(this._options.tooltips.callbacks.beforeLabel.call(this, bodyItem, data), lines);
+                helpers.pushAllIfDefined(this._options.tooltips.callbacks.label.call(this, bodyItem, data), lines);
+                helpers.pushAllIfDefined(this._options.tooltips.callbacks.afterLabel.call(this, bodyItem, data), lines);
                        }, this);
 
                        return lines;