Hello, poll like system and problem is in poll's vote count axis
appearing half numbers like 0.5, 1.5 .....
How can i avoid them?
.....
Runnable onLoadCallback = new Runnable() {
public void run() {
chart = new BarChart(createTable(), createOptions());
flowPanel.clear();
flowPanel.add(chart);
}
};
VisualizationUtils.loadVisualizationApi(onLoadCallback,
BarChart.PACKAGE);
.....
private Options createTable(){
final Options options = Options.create();
TextStyle textStyle = TextStyle.create();
TextStyle textStyleTitle = TextStyle.create();
textStyleTitle.setFontSize(12);
textStyle.setFontSize(9);
options.setWidth(publishObject.getWidth() == null ? 170 :
Integer.parseInt(publishObject.getWidth()) - 7);
options.setHeight(publishObject.getHeight());
options.setTooltipTextStyle(textStyle);
options.setLegend(LegendPosition.NONE);
options.setTitleTextStyle(textStyleTitle);
options.setFontSize(12);
final HorizontalAxisOptions horizontalAxisOptions =
HorizontalAxisOptions.create();
horizontalAxisOptions.setMaxAlternation(allVotes);
....
}
private AbstractDataTable createTable() {
final DataTable data = DataTable.create();
final LinkedHashMap<String, Integer> result =
publishObject.getPollAnswerAndVotes();
data.addColumn(AbstractDataTable.ColumnType.STRING, "Option");
data.addColumn(AbstractDataTable.ColumnType.NUMBER, "Vote");
data.addRows(result.size());
int row = 0;
for (Map.Entry<String, Integer> entry : result.entrySet()) {
data.setValue(row, 0, entry.getKey());
data.setValue(row++, 1, entry.getValue());
allVotes += entry.getValue();
}
return data;
}
thanks in advance!
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.