/**
* Compute an ordinal layout of axis marks.
*/
protected void ordinalLayout(VisualTable labels) {
ObjectRangeModel model = (ObjectRangeModel)m_model;
double span = m_hi-m_lo;
double pspan = m_prevhi-m_prevlo;
Rectangle2D b = getLayoutBounds();
double breadth = getBreadth(b);
double scale = breadth/span;
int step = getOrdinalStep(span, scale);
if ( step <= 0 ) step = 1;
// mark previously visible labels
Iterator iter = labels.tuples();
while ( iter.hasNext() ) {
VisualItem item = (VisualItem)iter.next();
reset(item);
double v = item.getDouble(VALUE);
double x = span==0 ? 0.5*breadth : ((v-m_lo)/span)*breadth;
set(item, x, b);
}
Index index = labels.index(VALUE);
// handle remaining labels
for ( int r, v=(int)m_lo; v<=m_hi; v+=step ) {
if ( (r=index.get((double)v)) >= 0 ) {
VisualItem item = labels.getItem(r);
item.set(VisualItem.LABEL, model.getObject(v).toString());
item.setVisible(true);
item.setEndVisible(true);
} else {
VisualItem item = labels.addItem();
item.set(VisualItem.LABEL, model.getObject(v).toString());
item.setDouble(VisualItem.VALUE, v);
double f = pspan==0 ? 0.5 : ((v-m_prevlo)/pspan);
if ( f <= 0 || f >= 1.0 ) item.setStartVisible(true);
set(item, f*breadth, b);
set(item, (v-m_lo)*breadth/span, b);