Data labels refer to the names for the data points which appear on the x-axis.

In the chart shown above, Jan 2006, Feb 2006 etc are the data labels for the chart. By default, they get wrapped when there is not enough space on the chart.

You can choose not to show the data labels by using <chart showLabels='0'>. By default, they're visible.

Modes for data labels

The data labels can be displayed on the charts in the following ways:

  • Wrap mode
  • Rotated and slanted mode
  • Staggered mode with customizable staggered lines
  • Every n-th label
Wrap Mode

By default, FusionCharts shows all the labels in wrap mode. The wrap mode enables you to wrap your long x-axis labels in multiple lines as shown below. To enable wrap mode, all you need to do is set :

<chart labelDisplay='WRAP'>

 
Rotating and Slanting Labels

You can opt to rotate the x-axis labels by using <chart labelDisplay='Rotate' ..>.

This method wouldn't work if you've non-english characters in your x-axis labels as FusionCharts uses embedded fonts to render rotated labels.

Consider the XML below:

<chart numberPrefix='$' labelDisplay='ROTATE'>
    <set label='Jan 2006' value='434' />
    <set label='Feb 2006' value='376' />
    <set label='Mar 2006' value='343' />
    <set label='Apr 2006' value='234' />
    <set label='May 2006' value='356' />
</chart>
It yields the following chart:
You can also slant the labels at 45 degree by using <chart labelDisplay='Rotate' slantLabels='1' ..> with the following results:
 
Staggering labels on multiple lines
FusionCharts v3 introduces the stagger mode for labels. Staggering basically distributes labels into multiple lines (by default 2). To enable stagger mode, just set <chart labelDisplay='Stagger' ..>. It will yield the following:
You can also choose how many lines to stagger the labels to by setting the number in <chart labelDisplay='Stagger' staggerLines='n' ..> where n is the number of lines. Shown below is an example with staggerLines set to 3.
 
Showing every n-th label
If your x-axis labels represent a continuous quantity like time, date etc. which are incremental in nature, you can opt to show every n-th label instead of all the labels. This enhances the clarity of the chart. Consider the XML below:
<chart numberPrefix='$' labelStep='4' showValues='0'>
    <set label='Jan 2006' value='434' />
    <set label='Feb 2006' value='376' />
    <set label='Mar 2006' value='343' />
    <set label='Apr 2006' value='234' />
    <set label='May 2006' value='356' />
    <set label='Jun 2006' value='183' />
    <set label='Jul 2006' value='365' />
    <set label='Aug 2006' value='357' />
    <set label='Sep 2006' value='375' />
    <set label='Oct 2006' value='345' />
    <set label='Nov 2006' value='655' />
    <set label='Dec 2006' value='435' />
    <set label='Jan 2007' value='586' />
</chart>

In the above chart, we're plotting consecutive months on the chart. So, if we show all the months, the chart gets cluttered. To avoid this, we've set labelStep as 4, so that every 4th x-axis label is only shown.

When you view the chart, you'll get following output:

 
Showing specific data labels
You can opt to show only specific data labels by using <chart showLabels='0'> and then setting showName='1' for the set you want to show the label. A chart having the same looks as under:
The XML going into the same is:
<chart numberPrefix='$' showLabels='0'>
    <set label='Jan 2006' value='434' />
    <set label='Feb 2006' value='376' showName='1'/>
    <set label='Mar 2006' value='343' />
    <set label='Apr 2006' value='234' />
    <set label='May 2006' value='356' />
</chart>
 
Changing Font Properties
Using a single font property for all the labels

If you want to specify a single font property for all the text outside canvas area, you can use outCnvBaseFont attribute group. The font properties specified as a part of this attribute group will be applied to Caption, Sub-Caption, X-Axis & Y-Axis names, Data Labels, Divisional Line and Trendline values.

The following attributes are a part of this group:

Attribute Name Description Example
outCnvbaseFont  Lets you define the font family e.g., Arial, Verdana etc outCnvBaseFont='Verdana'
outCnvbaseFontSize   Lets you define the font size (8-72) outCnvbaseFontSize='10'
outCnvbaseFontColor Lets you define the font color. Use hex code for the color without #. E.g., 000000 or 009933 or 999999 outCnvbaseFontColor='009933'
 
Example XML:

<chart caption='Quarterly Sales Summary' subcaption='Figures in $' xAxis='Quarter' yAxisName='Sales' outCnvBaseFont='Arial' outCnvBaseFontSize='12' outCnvBaseFontColor='333333'>
    <set label='Quarter 1' value='420500' />
    <set label='Quarter 2' value='295400' />
    <set label='Quarter 3' value='523400' />
    <set label='Quarter 4' value='465400' />
</chart>

 
Output:
As you can see above, all the text outside chart canvas has assumed the font properties specified as part of that attribute group.
 
Using Styles to specify font properties the data labels

If you do not want all the text on your chart to have similar font properties, you can use STYLES to define individual font properties for different text on the chart. Using STYLES, you can specify a different font name, size, color, background & border color and also make the text bold or italicized.

Shown below is a change in the basic font properties of the data labels.

The XML for this chart is as under. To read more on Styles, please see "For Web Developers > FusionCharts and STYLES" section.
<chart caption='Quarterly Sales Summary' subcaption='Figures in $' xAxisName='Quarter' yAxisName='Sales' showValues='0' >
    <set label='Qtr 1' value='420500' />
    <set label='Qtr 2' value='295400' />
    <set label='Qtr 3' value='523400' />
    <set label='Qtr 4' value='465400' />
    <styles>
        <definition>
            <style name='myLabelsFont' type='font' font='Arial' size='14' color='666666' bold='1' underline='1'/>
        </definition>
        <application>
            <apply toObject='DataLabels' styles='myLabelsFont' />
        </application>
    </styles>

</chart>
 

You can also define a background and border color for the data labels using STYLES.

 
<chart caption='Quarterly Sales Summary' subcaption='Figures in $' xAxisName='Quarter' yAxisName='Sales' showValues='0' >
    <set label='Qtr 1' value='420500' />
    <set label='Qtr 2' value='295400' />
    <set label='Qtr 3' value='523400' />
    <set label='Qtr 4' value='465400' />
    <styles>
        <definition>
            <style name='myLabelsFont' type='font' bgColor='FFFFFF' borderColor='666666'/>
        </definition>
        <application>
            <apply toObject='DataLabels' styles='myLabelsFont' />
        </application>
    </styles>

</chart>
 
Applying effects
You can also apply effects (shadow, glow, blur, bevel etc.) to the chart titles using STYLES. Shown below is an example:
Here, we've changed the font properties of the data labesl and applied a shadow to it. The XML can be listed as under:

<chart caption='Quarterly Sales Summary' subcaption='Figures in $' xAxisName='Quarter' yAxisName='Sales' showValues='0' >
    <set label='Quarter 1' value='420500' />
    <set label='Quarter 2' value='295400' />
    <set label='Quarter 3' value='523400' />
    <set label='Quarter 4' value='465400' />
    <styles>
        <definition>
            <style name='myLabelsFont' type='font' font='Arial' size='14' color='666666' bold='1' underline='1'/>
            <style name='myShadow' type='Shadow' color='999999' angle='45'/>
        </definition>
        <application>
            <apply toObject='DataLabels' styles='
myLabelsFont,myShadow' />
        </application>
    </styles>

</chart>

 
We can also apply a glow to the data labels as under:
Here, we've changed the font properties of the data labesl and applied a shadow to it. The XML can be listed as under:

<chart caption='Quarterly Sales Summary' subcaption='Figures in $' xAxisName='Quarter' yAxisName='Sales' showValues='0' >
    <set label='Quarter 1' value='420500' />
    <set label='Quarter 2' value='295400' />
    <set label='Quarter 3' value='523400' />
    <set label='Quarter 4' value='465400' />
    <styles>
        <definition>
            <style name='myLabelsFont' type='font' font='Arial' size='14' color='666666' bold='1' underline='1'/>
            <style name='myGlow' type='Glow' color='FF5904'/>
        </definition>
        <application>
            <apply toObject='DataLabels' styles='
myLabelsFont,myGlow' />
        </application>
    </styles>

</chart>

 
Applying animation to data labels
You can also apply animation effects to the data labels using STYLES. Shown below is an XML example which animates the x-position of the data labels from the center of the chart canvas to their respective positions.

<chart caption='Quarterly Sales Summary' subcaption='Figures in $' xAxisName='Quarter' yAxisName='Sales'>
    <set label='Quarter 1' value='420500' />
    <set label='Quarter 2' value='295400' />
    <set label='Quarter 3' value='523400' />
    <set label='Quarter 4' value='465400' />
    <styles>
        <definition>
            <style name='mynAnim' type='animation' type='animation' param='_x' start='$canvasCenterX' duration='1' />
        </definition>
        <application>
            <apply toObject='DataLabels' styles='myAnim' />
        </application>
    </styles>

</chart>