Thursday, July 29, 2010

Css in Visualizations charts

I have a GWT chart widget that uses the Visualizations api. I'm trying
to style individual cells in my chart widget using css. The end goal
is to differentiate selected cells from unselected by either changing
their border or applying a background image. I have not been able to
find a good example of how to do this. I am using NetBeans with Java
1.6. Right now I am trying to do something easy with some code that I
did find and change the border color of the cells to green. Here is my
current attempt (compiles fine, but not working)
private AbstractDataTable createTable() {
DataTable data = DataTable.create();
Properties props = Properties.create();
props.set("style", "border: 1px solid green; allowHtml:
true");
if ((counts == null) || counts.isEmpty()) {
data.addColumn(ColumnType.STRING, "Signal type");
data.addColumn(ColumnType.NUMBER, "Number of Fixes");
data.addRows(1);
data.setValue(0, 0, "No data");
data.setValue(0, 1, 0);
return data;
}

//else process counts
if (pie) { //pie chart
Set<String> keyset = counts.keySet();
data.addColumn(ColumnType.STRING, "Signal type");
data.addColumn(ColumnType.NUMBER, "Number of Fixes");

int i = 0;
for (String key : keyset) {
FixCat fix = counts.get(key);
int num = fix.count;
data.addRows(1);
data.setValue(i, 0, key);
data.setValue(i, 1, num);

data.setCell(i,1, num,key, props);
idmap.put(i, fix.getids());
System.out.println("i " + i + " key " + key + " num "
+ num + " fix id " + fix.getids());
i++;

}//end for
Column chart code is in the else block and is done in the same manner.
It does not work, either. I'm a newb with GWT, and not too good with
javascript. I am pretty experienced with Java, however. Any help or
pointers in where to look for a working example would be much
appreciated! Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment