Gantt > Using the Gantt Chart Through Examples > Automatically Updating Scales
 
Automatically Updating Scales
To update a scale, use the virtual method updateScale. This member function is called when a new transformation is applied to a corresponding grapher view, that is, a zoom or a horizontal translation. You can set the redraw parameter to IlFalse to prevent the contents of the scale and grapher views from being refreshed.
In the month example, the updateScale method is redefined as follows:
void
MonthGanttChart::updateScale(IlvScale* scale, IlvBoolean redraw) const
{
IlvContainer* container = getGadgetContainer();
IlvUShort count;
 
// Get index of the scale to be updated (0 if it is the left scale,
// 1 if it is the right scale)
IlvUShort hi = (IlvUShort)((scale == getScale(0)) ? 0 : 1);
 
// Get the labels to be displayed
char* labels[32];
computeScaleLabels(getShownStart(hi), getShownEnd(hi),
getStep(hi), count, labels);
 
MONTHGANTTDATA arg;
arg.count = count;
arg.labels = labels;
container->applyToObject(scale, SetScaleLabels, &arg, redraw);
 
// Clean memory
for (IlvUShort i = 0; i < count; ++i)
delete labels[i];
}

Version 6.1
Copyright © 2016, Rogue Wave Software, Inc. All Rights Reserved.