Setting the legend position of bar series data points.
As the previous topic illustrates, data points legends are displayed
next to the top of a bar series bars. However, in certain conditions, as a narrow
chart or a bar series with a large number of values, data points legends may
overlap each other, and the solution is to display the legends inside the bars.
The parameter seriex_marklegendposition can be
used to place legends inside the bars, horizontally or vertically oriented. This
parameter accepts three values:
- 0 - Places the legend on top of each bar. This is the default position.
- 1 - Places the legend horizontally inside each bar.
- 2 - Places the legend vertically inside each bar.
Depending on the dimension of a bar, a legend vertically arranged may not fit inside,
extending beyond the top. The parameter seriex_marklegendroomcheckon can
be used to toggle verification of available space inside a bar. If set to 'yes', should
a legend does not fit inside a bar it is not displayed. Room checking is not enabled by default.
Stacked bars series also support the parameters above.
The following example displays two bar series, one with data points legends displayed
horizontally inside the bars and the other displaying vertical legends.
<applet code="GraphApplet.class" codebase="../../../demo/applets/classes" archive="GraphChart.jar" width=400 height=300>
<param name="graphset0_gridon" value="yes">
<param name="graphset0_gridcolor" value="999999">
<param name="title" value="The JetChart Library,Setting the legend position of bar series data points">
<param name="labels" value="label1,label2,label3,label4">
<param name="serie1" value="bar,Bar series 1,ffff00">
<param name="serie1_values" value="100,130,90,110">
<param name="serie1_marklegendon" value="yes">
<param name="serie1_width" value="45">
<param name="serie1_marklegendposition" value="1">
<param name="serie2" value="bar,Bar Series 2,00ffff">
<param name="serie2_values" value="50,70,55,80">
<param name="serie2_marklegendon" value="yes">
<param name="serie2_width" value="15">
<param name="serie2_marklegendposition" value="2">
</applet>