本文整理汇总了Java中com.googlecode.gwt.charts.client.corechart.PieChartOptions.setWidth方法的典型用法代码示例。如果您正苦于以下问题:Java PieChartOptions.setWidth方法的具体用法?Java PieChartOptions.setWidth怎么用?Java PieChartOptions.setWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.googlecode.gwt.charts.client.corechart.PieChartOptions
的用法示例。
在下文中一共展示了PieChartOptions.setWidth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawPieChart
import com.googlecode.gwt.charts.client.corechart.PieChartOptions; //导入方法依赖的package包/类
/**
* Updates the pue chart with new data
* @param sentimentSummary
*/
private static void drawPieChart(JsArray<SentimentSummary> sentimentSummary) {
DataTable data = DataTable.create();
data.addColumn(ColumnType.STRING, "Sentiment");
data.addColumn(ColumnType.NUMBER, "Count");
data.addRows(sentimentSummary.length());
int j = sentimentSummary.length();
for (int i = 0; i < j; i++) {
data.setValue(i, 0, sentimentSummary.get(i).getId());
data.setValue(i, 1, sentimentSummary.get(i).getValue());
}
Legend legend = Legend.create();
legend.setPosition(LegendPosition.NONE);
PieChartOptions options = PieChartOptions.create();
options.setWidth(500);
options.setHeight(400);
ChartArea area = ChartArea.create();
area.setTop(50);
area.setLeft(25);
options.setChartArea(area);
options.setLegend(legend);
options.setColors("BDBDBD", "26A69A", "FF6E40");
pieChart.draw(data, options);
}
示例2: drawPieChart
import com.googlecode.gwt.charts.client.corechart.PieChartOptions; //导入方法依赖的package包/类
/**
* Updates the pue chart with new data
* @param sourcesSummary
*/
private static void drawPieChart(JsArray<SourceSummary> sourcesSummary) {
DataTable data = DataTable.create();
data.addColumn(ColumnType.STRING, "Client");
data.addColumn(ColumnType.NUMBER, "Count");
data.addRows(sourcesSummary.length());
int j = sourcesSummary.length();
for (int i = 0; i < j; i++) {
data.setValue(i, 0, sourcesSummary.get(i).getId());
data.setValue(i, 1, sourcesSummary.get(i).getValue());
}
Legend legend = Legend.create();
legend.setPosition(LegendPosition.NONE);
PieChartOptions options = PieChartOptions.create();
options.setWidth(500);
options.setHeight(400);
ChartArea area = ChartArea.create();
area.setTop(50);
area.setLeft(25);
options.setChartArea(area);
options.setLegend(legend);
options.setColors("00796b", "00897b", "009688", "26a69a", "4db6ac", "80cbc4", "b2dfdb");
pieChart.draw(data, options);
}
示例3: draw
import com.googlecode.gwt.charts.client.corechart.PieChartOptions; //导入方法依赖的package包/类
private void draw() {
// Prepare the data
DataTable dataTable = DataTable.create();
dataTable.addColumn(ColumnType.STRING, "Task");
dataTable.addColumn(ColumnType.NUMBER, "Hours per Day");
dataTable.addRows(2);
dataTable.setValue(0, 0, "Work");
dataTable.setValue(0, 1, 11);
dataTable.setValue(1, 0, "Sleep");
dataTable.setValue(1, 1, 7);
// Set options
PieChartOptions options = PieChartOptions.create();
options.setBackgroundColor("#f0f0f0");
// options.setColors(colors);
options.setFontName("Tahoma");
options.setIs3D(true);
options.setPieResidueSliceColor("#000000");
options.setPieResidueSliceLabel("Others");
options.setSliceVisibilityThreshold(0.1);
options.setTitle("So, how was your day?");
options.setHeight(100);
options.setWidth(100);
// Draw the chart
chart.draw(dataTable, options);
}