]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix missing tooltip value in radar charts (#6209)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Thu, 18 Apr 2019 20:39:52 +0000 (23:39 +0300)
committerSimon Brunel <simonbrunel@users.noreply.github.com>
Thu, 18 Apr 2019 20:39:52 +0000 (22:39 +0200)
src/controllers/controller.radar.js
test/specs/controller.radar.tests.js

index 770ddc51afe450c4ff8d41d9b35d07bbbd3662f9..20383c677e662953976bf12e43df4fa3cc1a7ac9 100644 (file)
@@ -20,6 +20,19 @@ defaults._set('radar', {
 });
 
 module.exports = DatasetController.extend({
+       /**
+        * @private
+        */
+       _getValueScaleId: function() {
+               return this.chart.scale.id;
+       },
+
+       /**
+        * @private
+        */
+       _getIndexScaleId: function() {
+               return this.chart.scale.id;
+       },
 
        datasetElementType: elements.Line,
 
index 6b2c754547cabb0d2b48b61fcc506dba05e6292a..b9a233d129b6e82df753f2e5505164c35dc00cae 100644 (file)
@@ -443,4 +443,24 @@ describe('Chart.controllers.radar', function() {
                expect(meta0.data[0]._model.radius).toBe(10);
                expect(meta1.data[0]._model.radius).toBe(20);
        });
+
+       it('should return same id for index and value scale', function() {
+               var chart = window.acquireChart({
+                       type: 'radar',
+                       data: {
+                               datasets: [{
+                                       data: [10, 15, 0, 4],
+                                       pointBorderWidth: 0
+                               }],
+                               labels: ['label1', 'label2', 'label3', 'label4']
+                       },
+                       options: {
+                               scale: {id: 'test'}
+                       }
+               });
+
+               var controller = chart.getDatasetMeta(0).controller;
+               expect(controller._getIndexScaleId()).toBe('test');
+               expect(controller._getValueScaleId()).toBe('test');
+       });
 });