Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One legend for two or more charts (pie) #211

Open
robertobadjio opened this issue Apr 17, 2015 · 0 comments
Open

One legend for two or more charts (pie) #211

robertobadjio opened this issue Apr 17, 2015 · 0 comments

Comments

@robertobadjio
Copy link

Hello. Do not get to do one legend on two or more diagrams.
pie2 = r.piechart(545, 440, 25, [0, 22.22, 22.22, 11.11, 44.44]);
pie = r.piechart(490, 540, 25, [0, 0, 12.5, 25, 62.5], {
legend: ["-20%", "21 - 40 %", "41 - 60 %", "61 - 80 %", "81 - 100 %"],
colors: [
"#475664",
"#8C5F66",
"#DB7369",
"#F29961",
"#F0B165"
],
legendpos: "west",
legendothers: "Другие",
});

for(var i = 0, l = pie.labels.length; i < l; i++ ) {
        pie.labels[i].attr("font", "13px sans-serif");
        pie.labels[i].attr("x", 230+20);
        pie.labels[i].attr("cx", 230);
        pie.labels[i].attr("y", 535+i*20);
        pie.labels[i].attr("cy", 535+i*20);
        pie.labels[i][1].attr( "fill", "#000000" );
    }

pie.hover(function () {
this.sector.stop();
this.sector.scale(1.1, 1.1, this.cx, this.cy);

                if (this.label) {
                    this.label[0].stop();
                    this.label[0].attr({ r: 7.5 });
                    this.label[1].attr({ "font-weight": 800 });
                }
            }, function () {
                this.sector.animate({ transform: 's1 1 ' + this.cx + ' ' + this.cy }, 500, "bounce");

                if (this.label) {
                    this.label[0].animate({ r: 5 }, 500, "bounce");
                    this.label[1].attr({ "font-weight": 400 });
                }
            });

            pie2.hover(function () {
                this.sector.stop();
                this.sector.scale(1.1, 1.1, pie2.cx, pie2.cy);

                pie.labels[1].stop();
                pie.labels[1].attr({ r: 7.5 });
                pie.labels[1].attr({ "font-weight": 800 });

            }, function () {
                this.sector.animate({ transform: 's1 1 ' + pie2.cx + ' ' + pie2.cy }, 500, "bounce");

                pie.labels[1].animate({ r: 5 }, 500, "bounce");
                pie.labels[1].attr({ "font-weight": 400 });

            });
@robertobadjio robertobadjio changed the title One legend into two or more charts (pie) One legend for two or more charts (pie) Apr 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant