Animating Bars in Wijmo BarChart

WijBarChart displays the chart data in the form of static bars, that displays the YAxis data. Here in this blog, we will discuss how to animate bars of Wijmo BarChart on hovering mouse.


The basic idea is to change the position of the bar, when the mouse is hovered over or out of the bar. To do this, we will use the hover event of the bartracker class. Here is the complete code :

  //Code to callout bars
  var oldx = 0;
  var oldindex = -1;
  $(\".bartracker\").hover(function (e) {
        var target = $(;
        if ('owner')) {
            target ='owner');
        var data ='wijchartDataObj');
        if (data) {
           var sbar =;
           oldx = sbar.attrs.x;
           oldindex = data.index;
           var newx = sbar.attrs.x + 20;
           sbar.attr(\"x\", newx);
      }, function (e) {
         if (oldx != 0 && oldindex != -1) {
              var obar = $(\"#wijbarchart\").wijbarchart(\"getBar\", oldindex);
              obar.attr(\"x\", oldx);


Here is how our BarChart would look like after the above implementation :

Download sample for complete implementation.


GrapeCity Developer Tools
comments powered by Disqus