public class Grid extends Object
A Grid returns values based on one or more
"axes". For example, suppose you have cross-tab data in the following form:
{ Name: Smith, Quarter: 1Q06, Sales: 3000 }
{ Name: Smith, Quarter: 2Q06, Sales: 4200 }
{ Name: Smith, Quarter: 3Q06, Sales: 4500 }
{ Name: Jones, Quarter: 1Q06, Sales: 1200 }
{ Name: Jones, Quarter: 2Q06, Sales: 1600 }
In this case, you create a Grid with 2 axisNames ("Name" and "Quarter") and with
a valueName "Sales". The items in each axis (e.g., "Smith" and "3Q06") are called Labels,
and are typically used as labels for the axes of a graph or table.
These Labels are also used to look up each value to display using
the getValue method. In the example above, using
getValue for the Labels "Smith" and "3Q06" would return "4500".
| Constructor and Description |
|---|
Grid(Iterator analytics,
String valueName,
List axisNames)
Constructs a Grid from the specified Endeca analytics data.
|
Grid(Iterator analytics,
String valueName,
String axis)
Convenience constructor for a one-axis Grid - same as passing in a List containing the strings.
|
Grid(Iterator analytics,
String valueName,
String axisOne,
String axisTwo)
Convenience constructor for a two-axis Grid - same as passing in a List containing the two strings.
|
| Modifier and Type | Method and Description |
|---|---|
List |
getLabels(int axis)
Returns the List of Labels for the specified axis.
|
int |
getNumAxes()
Returns the number of "axes" (that is, the number of labels) in the grid.
|
Cell |
getValue(Label label)
Convenience method - same as passing in a List containing the Label.
|
Cell |
getValue(Label labelOne,
Label labelTwo)
Convenience method - same as passing in a List containing the two Labels.
|
Cell |
getValue(List labels)
Returns the value at the location indicated by the labels.
|
void |
sortLabels(int axis,
Comparator comparator)
Causes the labels in the specified axis to be sorted by the
specified comparator.
|
public Grid(Iterator analytics, String valueName, String axis)
public Grid(Iterator analytics, String valueName, String axisOne, String axisTwo)
public Grid(Iterator analytics, String valueName, List axisNames)
analytics - The analytics results to use.valueName - The name of the property or dimension that holds the value to chart.axisNames - The names of the properties or dimensions that hold the labels of
each "axis" of the grid.public void sortLabels(int axis,
Comparator comparator)
public int getNumAxes()
public List getLabels(int axis)
public Cell getValue(Label label)
public Cell getValue(Label labelOne, Label labelTwo)
© 2003, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle and/or its affiliates Confidential