我看不到制作图表标题中心的任何选项。我尝试使用setHorizontalAlignment(HasHorizontalAlignment)也没有受到影响。请问。
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);
}
};
答案 0 :(得分:0)
这应该有效:
PieChart.PieOptions options = ....
Options legend = Options.create();
Options.set("alignment","center");
options.set("legend",legend);