Can get labels to work on raphael.js barchart

4.9k views Asked by At

When i'm trying to get my raphael chart labels, I get this error :

bars[i * (multi || 1) + j] is undefined
http://localhost:8080/en/plugins/SocialConversationPlugin/js/g.bar-min.js
Line 149

the line :

L = paper.g.text(bars[i * (multi || 1) + j].x, isBottom ? y + height - barvgutter / 2 : bars[i * (multi || 1) + j].y - 10, label).insertBefore(covers[i * (multi || 1) + j]);

My code :

$$("#activityTab td.month").each(function (s) {
      labels.push(s.innerHTML);
    }); 


    var r = Raphael("holder",1000,260),
    data2 = [ligne1, ligne2, ligne3],
    fin = function () {
             this.flag = r.g.popup(this.bar.x, this.bar.y, this.bar.value || "0").insertBefore(this);
          },
          fout = function () {
             this.flag.animate({opacity: 0}, 300, function () {this.remove();});
    };

    r.g.txtattr.font = "12px 'Fontin Sans', Fontin-Sans, sans-serif";

    r.g.text(562, 250, "Multiple Series Stacked Chart");

    r.g.barchart(150, 10, 700, 220, data2, {stacked:false, type: "soft"})
    .hover(fin, fout)
    .label(labels);

The chart is drawn but I'm just getting the first letter of the first label drawn to my chart.

1

There are 1 answers

0
cnu On BEST ANSWER

It is because of this issue.

Can be solved by using the g.bar.js file from this github repository.