]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
inGroupRange function for bar charts label mode
authorTanner Linsley <tannerlinsley@gmail.com>
Fri, 15 May 2015 23:07:41 +0000 (17:07 -0600)
committerTanner Linsley <tannerlinsley@gmail.com>
Fri, 15 May 2015 23:07:41 +0000 (17:07 -0600)
src/Chart.Bar.js
src/Chart.Core.js

index fcf159978518fd8b2c8123aedd17dae7a45faabc..4fea73f5c0e2efce631f5fce7c039a3fb837353a 100644 (file)
                        }
 
 
+                       this.tooltip.pivot();
+
                        // Hover animations
                        if(!this.animating){
                                var changed;
                                        (this.lastActive.length && !this.active.length)||
                                        (this.lastActive.length && this.active.length && changed)){
 
-                                       this.tooltip.pivot();
                                        this.stop();
                                        this.render(this.options.hoverAnimationDuration);
                                }
 
                        this.scale.update();
 
-                       this.eachElement(function(bar, index, datasetIndex){
+                       this.eachElement(function(bar, index, dataset, datasetIndex){
                                helpers.extend(bar, {
                                        width : this.scale.calculateBarWidth(this.data.datasets.length),
                                        x: this.scale.calculateBarX(this.data.datasets.length, datasetIndex, index),
index 93b7deb5e544485a8f2ceb9f46304950e77309ce..0fa13465d47b7263fa37eeb502236d2d454eba94 100755 (executable)
                        var vm = this._vm;
                        return vm.base - vm.y;
                },
-               inRange : function(chartX,chartY){
+               inRange : function(mouseX,mouseY){
                        var vm = this._vm;
                        if (vm.y < vm.base){
-                               return (chartX >= vm.x - vm.width/2 && chartX <= vm.x + vm.width/2) && (chartY >= vm.y && chartY <= vm.base);
+                               return (mouseX >= vm.x - vm.width/2 && mouseX <= vm.x + vm.width/2) && (mouseY >= vm.y && mouseY <= vm.base);
                        } else{
-                               return (chartX >= vm.x - vm.width / 2 && chartX <= vm.x + vm.width / 2) && (chartY >= vm.base && chartY <= vm.y);
+                               return (mouseX >= vm.x - vm.width / 2 && mouseX <= vm.x + vm.width / 2) && (mouseY >= vm.base && mouseY <= vm.y);
                        }
                },
+               inGroupRange: function(mouseX){
+                       var vm = this._vm;
+                       return (mouseX >= vm.x - vm.width/2 && mouseX <= vm.x + vm.width/2);
+               },
                tooltipPosition : function(){
                        var vm = this._vm;
                        if (vm.y < vm.base){