GClasses
GClasses::GPlotLabelSpacer Class Reference

Detailed Description

If you need to place grid lines or labels at regular intervals (like 1000, 2000, 3000, 4000... or 20, 25, 30, 35... or 0, 2, 4, 6, 8, 10...) this class will help you pick where to place the labels so that there are a reasonable number of them, and they all land on nice label values.

#include <GPlot.h>

Public Member Functions

 GPlotLabelSpacer (double min, double max, int maxLabels)
 maxLabels specifies the maximum number of labels that it can ever decide to use. (It should be just smaller than the number of labels that would make the graph look too crowded.) More...
 
int count ()
 Returns the number of labels that have been picked. It will be a value smaller than maxLabels. More...
 
double label (int index)
 Returns the location of the n'th label (where 0 <= n < count()) More...
 

Protected Attributes

int m_count
 
double m_spacing
 
int m_start
 

Constructor & Destructor Documentation

GClasses::GPlotLabelSpacer::GPlotLabelSpacer ( double  min,
double  max,
int  maxLabels 
)

maxLabels specifies the maximum number of labels that it can ever decide to use. (It should be just smaller than the number of labels that would make the graph look too crowded.)

Member Function Documentation

int GClasses::GPlotLabelSpacer::count ( )

Returns the number of labels that have been picked. It will be a value smaller than maxLabels.

double GClasses::GPlotLabelSpacer::label ( int  index)

Returns the location of the n'th label (where 0 <= n < count())

Member Data Documentation

int GClasses::GPlotLabelSpacer::m_count
protected
double GClasses::GPlotLabelSpacer::m_spacing
protected
int GClasses::GPlotLabelSpacer::m_start
protected