Gantt > Using the Gantt Chart Through Examples > Customizing Gantt Scales
 
Customizing Gantt Scales
The scale is actually created by the makeView call, using the virtual method IlvGanttChart::createScale. This method creates and returns the scale graphic object at the given origin point. The limits of the time shown are given by start and end. The size parameter indicates the scale size. You can redefine this method to initialize user-defined scale internal values or to customize your own scale.
In the month example, the createScale method is redefined as follows:
IlvScale*
MonthGanttChart::createScale(IlvDisplay* display, const IlvPoint& orig,
IlvDim size, IlvInt start, IlvInt end,
IlvUShort step, IlvPosition position) const
{
IlvUShort count;
char* labels[32];
 
// Internal method to create every label displayed on the scale
computeScaleLabels(start, end, step, count, labels);
// Create the scale object
IlvRectangularScale* scale =
new IlvRectangularScale(display, orig, size, labels,
IlvHorizontal, position, count,
12, 10, 5, getPalette());
 
// Labels will be centered
scale->centerLabels(IlTrue);
 
// Labels cannot overlap
scale->drawOverlappingLabels(IlFalse);
 
// Clean memory
for (IlvUShort i = 0; i < count; ++i)
delete labels[i];
 
return scale;
}

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