GWT:如何设置饼图标题中心

时间:2013-11-30 04:48:16

标签: charts alignment

我看不到制作图表标题中心的任何选项。我尝试使用setHorizo​​ntalAlignment(HasHorizo​​ntalAlignment)也没有受到影响。请问。

private PieChart.PieOptions createPassFailOptions() {
    PieChart.PieOptions options = PieChart.createPieOptions();
    options.setWidth(500);
    options.setHeight(340);
    options.set3D(true);
    options.setFontSize(15);
    options.setBackgroundColor("F0F8FF");
    options.setTitle("Total Passed & Failed");
    options.setColors("lightgreen","lightcoral","yellow");      
    TextStyle textStyle = TextStyle.create();
    textStyle.setColor("black");
    options.setPieSliceTextStyle(textStyle);        
    return options;
  }
        ////////  Draw pie chart
        Runnable onLoadCallback1 = new Runnable() {
              public void run() {
                PieChart pie = new PieChart(createPassFailTable(), createPassFailOptions());
                pie.addSelectHandler(createSelectHandler(pie));
                piePassFailPanel.add(pie);
              }
            };

1 个答案:

答案 0 :(得分:0)

这应该有效:

PieChart.PieOptions options = ....
Options legend = Options.create();
Options.set("alignment","center");
options.set("legend",legend);