I have been able to make an OrgChart with the GWT Wrappers, and it
loads well, how ever it loads everything in my database (I implemented
a datasource) which is not what what I want always. I also want to be
able to pass parameters to the query so that it can start the OrgChart
from the matching node instead of always from the ROOT. Here is a
snippet from my client side (ChartPanel.java) code :

  VisualizationUtils.loadVisualizationApi(new Runnable(){
          public void run() {
              chartQuery = Query.create("http://localhost:8080/sungold/
chartservice");
              setRefreshInterval(refreshInterval);
              // when this line is uncommented, it gets no rows
              chartQuery.setQuery("select * where id = 26");
              chartQuery.send(new Query.Callback() {

                    public void onResponse(QueryResponse response) {
                        unmask();
                        if(response.isError()){
                            handleQueryError(response);
                        }

                        DataTable data = response.getDataTable();
                        OrgChart.Options options =
OrgChart.Options.create();
                        options.setAllowCollapse(true);
                        options.setAllowHtml(true);
                        options.setSize(OrgChart.Size.SMALL);
                        orgChart = new OrgChart(data, options);
                        orgChart.addSelectHandler(new SelectHandler()
{
                            @Override
                            public void onSelect(SelectEvent event) {
                                throw new
UnsupportedOperationException("Not supported yet.");
                            }
                        });
                        add(orgChart);
                        layout(true);
                        ready = true;
                        //drawChart(data, options);
                    }
                });
        }}, OrgChart.PACKAGE);
    }

and then my datasource form the server (RemoteChartService) is thus :
public DataTable generateDataTable(Query query, HttpServletRequest
hsr) throws DataSourceException {
        DataTable data = new DataTable();
        ChartNodeDao nodeDao = new ChartNodeDao();

        data.addColumn(new ColumnDescription("id", ValueType.TEXT,
null));
        data.addColumn(new ColumnDescription("upline", ValueType.TEXT,
null));
        data.addColumn(new ColumnDescription("tip", ValueType.TEXT,
null));
        //data.addColumn(new ColumnDescription("member",
ValueType.TEXT, null));

        // this returns everything from the database table
        ArrayList<ChartNode> nodeList = (ArrayList<ChartNode>)
nodeDao.findEntities();

        for (ChartNode node : nodeList) {
            String owner = node.getOwner().getFullName();
            String tip = node.getOwner().getFullName() + "  " +
node.getSlot().getTitle();

            String uplineVal = "";
            String nodeId = String.valueOf( node.getSlot().getId() );
            Slot upline = node.getUpline();

            if(upline != null){
                uplineVal =
String.valueOf( node.getUpline().getId() );
            }

            TableRow row = new TableRow();
            row.addCell( new TableCell(new TextValue(nodeId),
owner) );
            row.addCell(uplineVal);
            row.addCell(tip);
            data.addRow(row);
        }

        return data;
    }

You can see clearly that my datatable defines an id field, which also
gets populated, but I just cannot query it with something like
chartQuery.setQuery("select * where id = 26"); Please am I missing
something ??
First I'd like to use this query value to pull the data from the
database, instead of loading hundreds of records that will not be
used, and then the chart should now have just what it needs to work.
Any hints on this

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

Reply via email to