Below is the code I am using. I tried to remove some lines that
weren't applicable to the problem - so if this doesn't quite compile,
it may be due to that. But I believe I've captured the essence of the
logic.
private void processDeskTops(List deskTops, final long capacity)
{
dataTable = createDataTable();
// Row count = 4 rows per desktop plus 2 additional rows
int newRows = (deskTops.size() * 4) + 2;
dataTable.addRows(newRows);
int row = 0;
long avail = (computer.getAvailableBytes() == 0) ? 0 :
computer.getAvailableBytes();
dataTable.setValue(row, 0, "Free Space");
dataTable.setValue(row, 1, avail);
row++;
long reserved = (computer.getReservedBytes() == 0) ? 0 :
computer.getReservedBytes();
dataTable.setValue(row, 0, "Used Space");
dataTable.setValue(row, 1, reserved);
row++;
for (int ii=0; ii < deskTops.size(); ii++)
{
final UserDesktopGWT userDesktop = (UserDesktopGWT)
deskTops.get(ii);
long sysUsed = userDesktop.getSystemDiskUsedBytes();
long sysReserved = userDesktop.getSystemDiskReservedBytes
();
long userUsed = userDesktop.getUserDiskUsedBytes();
long userReserved = userDesktop.getUserDiskReservedBytes
();
dataTable.setValue(row, 0, counter + ": " +
userDesktop.getName() + " System Disk Used");
dataTable.setValue(row, 1, sysUsed);
row++;
dataTable.setValue(row, 0, userDesktop.getName() + "
System Disk Reserved");
dataTable.setValue(row, 1, sysReserved);
row++;
dataTable.setValue(row, 0, userDesktop.getName() + " User
Disk Used");
dataTable.setValue(row, 1, userUsed);
row++;
dataTable.setValue(row, 0, userDesktop.getName() + " User
Disk Reserved");
dataTable.setValue(row, 1, userReserved);
row++;
}
// Remove the previous panel containing the PieChart
if (panel != null)
{
remove(panel.getId());
}
// Create a new PieChart and add it to the panel
Options options = Options.create();
options.set3D(true);
options.setHeight(400);
options.setWidth(650);
options.setTitle("Capacity");
pieChart = new PieChart(dataTable, options);
pieChart.setVisible(true);
panel = new Panel();
panel.add(pieChart);
this.insert(3,panel);
this.doLayout();
}
private DataTable createDataTable()
{
DataTable dt = DataTable.create();
dt.addColumn(ColumnType.STRING, "Item");
dt.addColumn(ColumnType.NUMBER, "In Use");
return dt;
}
On Jan 8, 6:01 am, VizGuy <[email protected]> wrote:
> Could you send some code snippet?
> This might be very helpful in order to recreate the problem.
>
> Regards,
> VizGuy
>
> On Thu, Jan 8, 2009 at 3:33 AM, ped <[email protected]>wrote:
>
>
>
> > I am using the GWT wrappers to access the visualization API. I'm
> > creating a PieChart that I add 10 rows to - but I only see 5 rows
> > displayed. I set the row count to 10 and add 2 rows. Then in a loop, I
> > add 4 rows each time thru a loop which processes a list of objects. In
> > my test case, there are 2 objects in the list.
> > When the chart displays, I see the first 2 rows I added outside of the
> > loop, and the first 3 rows from the first time in the loop.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---