Web App Development

gRaphael legendmarks for pie charts

According to the gRaphael documentation you can use the legendmark option to set the shape of the bullet point next to the legend entry. The default is given as "circle" and I was trying to find out if there are any other options.

The legendmark option doesn't seem to be functional at the moment. Take a look at the code:

            mark = paper[mark && mark.toLowerCase()] || "circle";
chart.labels = paper.set();
chart.labels[i].push(paper[mark](x + 5, h, 5).attr({ fill: clr, stroke: "none" }));

The legendmark is drawn using the Raphael paper function of the same name as the legendmark (e.g. "circle"). But if you specify a legendmark gRaphael tries to fetch the function twice - the "paper[mark]" parts above, resulting in an error as the code tries to call undefined as a function. This is the case even if you pass "circle" as the option value.

There's a related pull request on github, but gRaphael development seems dormant.


Follow me on Twitter