The Smart Labeling feature paint labels for charts automatically by evaluating X
values and determining the best logical step to view data clearly. This feature
is embedded into Chart FX; therefore, it is by default in effect. However, by
manually configuring a selected axis step, this feature may be easily
overridden.
Note: The Smart Labeling feature is only employed when Date or
DateTime X Values are present in a chart. Please review XY Plots &
Scatter in the Gallery Types section of the Programmer's Guide for
more information on these types of graphs.
This feature proves to be most helpful for developers and useful to
end-users when chart data includes date and time as X Values. This feature is
also commonly used in conjunction with Data Driven Labeling. For more
information regarding this topic, please see the Data Driven Labeling section of
this reference.
Depending on the values passed to the chart and the dimensions of the chart
(width), Chart FX will calculate a 'nice' increment to display for the labels.
For example, when you have a year of data, and they chart size permits, each
month could be used for the string. When dealing with date-formatted axes, the
label step is as follows:
- Year
- Semi-Anual
- Quarter
- Bi-Monthly
- Month
- Bi-Weekly
- Day
It is also important to mention the last day of a label break will be used for
the label. For example, when the 'Bi-Monthly' step is applied, the last day of
the 2-month range will be used as the label string (painting the tick mark and
label on that day). Inversely, when the range has a name, such as a Year,
Quarter or Month, each section will be labeled using a
Centered style and using the appropriate name.
When dealing with time-formatted axes, additional label steps are supported.
The label steps for time are as follows:
- 12 hour
- 6 hour
- 1 hour
- 1/2 hour
- 1/4 hour
- 10 min
- 5 min
- 1 min
- 30 sec
- 15 sec
- 10 sec
- 5 sec
- 1 sec
- less that 0.5 sec leave alone
Note: If you manually configure the axis scale using the Step
property of the Axis object, all the smart labeling logic is disregarded.
Below is some sample code that forces Chart FX to utilize the embedded Smart
Labeling feature. If you recompile with various chart width values,
you will see how the scale will change based on the size of the chart. This is
the Smart Labeling feature at work.
Date dateTime = new Date(2005,1,12); chart1.getAxisX().getLabelsFormat().setFormat(AxisFormat.DATE); chart1.getAxisX().setLabelAngle((short)90); chart1.openData(COD.VALUES, 1, 365); chart1.openData(COD.XVALUES, 1, 365); for (int i = 0; i < 365; i++) { chart1.setValue(0,i) = i * i; chart1.setXValue(0,i) = dateTime.AddDays(i).ToADate(); } chart1.closeData(COD.XVALUES); chart1.closeData(COD.VALUES);
|
This code will produce the following Chart:

As you resize the form, the labeling will be changing as shown in the following pictures:



|