拉斐尔圆圈内的文字

Text inside circle with Raphael

我正在尝试用 Raphael 复制以下图像:

到目前为止,我只设法让圆圈工作。我如何获得模糊的灰色轮廓(显示剩余部分)和圆圈内的文本。

var score = 883
var amount = score/1000 * 100;

var archtype = Raphael("canvas", 200, 100);
archtype.customAttributes.arc = function (xloc, yloc, value, total, R) {
    var alpha = 360 / total * value,
        a = (90 - alpha) * Math.PI / 180,
        x = xloc + R * Math.cos(a),
        y = yloc - R * Math.sin(a),
        path;
    if (total == value) {
        path = [
            ["M", xloc, yloc - R],
            ["A", R, R, 0, 1, 1, xloc - 0.01, yloc - R]
        ];
    } else {
        path = [
            ["M", xloc, yloc - R],
            ["A", R, R, 0, +(alpha > 180), 1, x, y]
        ];
    }
    return {
        path: path
    };
};

var my_arc = archtype.path().attr({
    "stroke": "#00BB7B",
    "stroke-width": 7,
    arc: [50, 50, 0, 100, 30]
});

my_arc.animate({
    arc: [50, 50, amount, 100, 30]
}, 1500, "bounce");

Jsfiddle 在这里:http://jsfiddle.net/1eh7dmgu/

1) 平衡你可以显示只是把它放在绿色弧形封闭的灰色弧形下面:

var remainder = archtype.path().attr({
    "stroke": "#eeeeee",
    "stroke-width": 7,
    arc: [50, 50, 100, 100, 30]
});

2) 动画文字计数器也可以使用manual属性:

archtype.customAttributes.counter = function (counter) {
    return { text: counter, counter: counter }
}

[http://jsfiddle.net/mwvLc0kb/]