拉斐尔饼图传奇字体

时间:2012-10-24 06:32:21

标签: raphael font-size legend

我的饼图中的图例太小了...我怎样才能使文字大小更大。以下是代码:

<?xml version="1.0" encoding="UTF-8"?>
<html lang="en">
<head>
  <meta charset="utf-8">
  <script src="raphael-min.js"></script>
  <script src="g.raphael-min.js"></script>
  <script src="g.pie-min.js"></script>
  <script>
    window.onload = function () {
      var r = Raphael("holder");
      pie = r.piechart(320, 240, 100, [10,20,0,0],
            {
              legend: ["%% Unknown","%% Recognisable","%% Familiar","%% Known"],
              colors: ["#FF0000","#FFB2B2","#CCFFCC","#00E600"], 
              legendpos: "west"
            });
    };
  </script>
</head>
<body>
  <div id="holder"></div>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

如果我没记错的话,g.Raphael中的传说就不可配置了。如果您想要更多地控制它,您可能想要自己构建图例。有关如何执行此操作的示例,请参阅this gist on github

如果有图例,请按如下方式控制字体大小:

t = paper.text(x, y, 'Data set 1');
t.attr({ 'font-size': 24 });