I am having difficulty in customizing default tool tip text of PieChart.Here are the details of of API: gwt-visualization 1.1.2, Gwt2.0 and Gxt 2.1.1. Here is the link what i have followed , but there is no luck.
Code:
JSNI:
private native DataTable addTooltipColumn(DataTable data) /*-{
data.addColumn({type: 'string', role: 'tooltip'});
return data;
}-*/;
DataTable:
private AbstractDataTable createTable() {
DataTable data = DataTable.create();
data.addColumn(ColumnType.STRING, "Task");
data.addColumn(ColumnType.NUMBER, "Hours per Day");
//Assigning the variable
data = addTooltipColumn(data);
List<Integer> asList = Arrays.asList(34,12,34,32,67,21,2,45,2,4,28,5,78);
data.addRows(asList.size());
int i=0;
for (Integer integer : asList) {
data.setValue(i, 0, "Work"+i);
data.setValue(i, 1, integer);
data.setValue(i, 2, "....Tool Tip Txt...");
i++;
}
return data;
}
It seems that tooltips are currently not supported in
Piecharts
(see here for reference).I tested it also in pure javascript and tools are not displayed in Piecharts:
http://jsfiddle.net/d9tezLL3/
If you change in the above example from
PieChart
toColumnChart
it will display the tooltips.All you can do is create a static tooltip actions with
PieChart
.In general I would recommend to use the inofficial gwt-charts instead of the official
gwt-visualization
library because the former is updated and supports recent features and charts out of the box (DataRoles, tooltips, etc)