Hi,

I have implemented a chart that displays stacks for each x axis
component with multiple values. For example, If I apply two level of
grouping on x axis (say A, B fields) then A's data grouped by B's data
will be displayed on the A's values which are x Axis coordinates. To
illustrate, lets assumea table with columns as Name, Designation,
Address, Department EmailD. I want to display the chart data based on
grouping of department and designation. So the chart will be plotted
with Department - Account having stack values as Account-Manager,
Account-Clerk, Account-Accountant. This represents one bar in the
column chart. The other bar may have some other department ,say,
Library with stack values Library-Checker, Library-issuer etc...
Consider that Y Axis has a count field that represents the count of
each department-designation

I am able to plot this chart but the problem comes with display of
legends. Legend color is displyed but the legend text is not
displayed.

Here is the datatable method which I am using to set the values

<code>
public DataTable getDataTable() {
                dataTable = DataTable.create();
                int maxSize = getMaxColumns();// represents how many stacks 
will be
created for each x Axis field.
// rowSize - get the number of fields on x Axis.
                int rowSize = 
chartTableObject.getDataTableValuesObjList().size();

                dataTable.addColumn(ColumnType.STRING,
chartTableObject.getxAxisTitle());
// add the x Axis fieds
                for (int index = 0; index < maxSize; index++) {
                        dataTable.addColumn(ColumnType.NUMBER, "");
                }

                dataTable.addRows(rowSize);
                for (int index = 0; index < rowSize; index++) {
// set the x Axis field
                        dataTable.setValue(index, 0, chartTableObject
                                        
.getDataTableValuesObjList().get(index).getxAxisField());
// this MAP holds the key (x axis field) and value(all the values for
this field)
                        Iterator<Map.Entry<String, Double>> mapIterator = 
chartTableObject
                                        .getDataTableValuesObjList().get(index)
                                        
.getValuesPerXAxisField().entrySet().iterator();

                        while (mapIterator.hasNext()) {
                                try{
                                Map.Entry<String, Double> pair = 
(Map.Entry<String, Double>)
mapIterator
                                                .next();
                                String colDisplay = pair.getKey();
                                int hyphenIndex = colDisplay.indexOf("-");
                                colDisplay = colDisplay.substring(hyphenIndex+1,
colDisplay.length());
// using -> public final native void setCell(int rowIndex, int
columnIndex, double value, String
// formattedValue,Properties properties)
dataTable.setCell(index, count, pair.getValue(), colDisplay+"
"+pair.getValue(), null);
// it wil display xaxis field something like Account-> 'Manager-12',
'Clerk-15'

                                }catch (Exception e) {
                                        System.out.println("Exception while 
iterating map to add values
to datatable "+e.getMessage());
                                }
                        }
                }
                return dataTable;
        }
</code>

-- 
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.

Reply via email to