Issue in customizing default tooltip text of PieChart using gwt-visualization 1.1.2 API

1.5k views Asked by At

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;
          }

Default text on mouse over:

1

There are 1 answers

6
Ümit On BEST ANSWER

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 to ColumnChart 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)