### RCHART, User Guide

Copyright 2005, J4L Components (http://www.java4less.com)
Go bak to contents

### Piechart configuration

The following is a complete example of a Piechart:

Parameters | Description | Equivalent java class/property
TITLECHART=Sales 1999 LEGEND_FILL=WHITE LEGEND_VERTICAL=FALSE LEGEND_BORDER=0.2|0x0|NORMAL SERIE_1=Pie SERIE_TYPE_1=PIE SERIE_DATA_1=94|48|28 PIE_NAME_1=Products PIE_NAME_2=Services PIE_NAME_3=Other PIE_STYLE_1=RED PIE_STYLE_2=BLUE PIE_STYLE_3=GREEN PIECHART_3D=true PIE_LABEL_FORMAT=#VALUE# (#PERCENTAGE#) SERIE_LABELS_1=Products|Services|Other SERIE_TOGETHER_1=true|false|true LEGEND_POSITION=TOP LEGEND_MARGIN=0.3 CHART_BORDER=0.2|0x0|NORMAL CHART_FILL=0x99cccc | Text of the title Legend background Legend layout Legend border Name of the serie Type of the series Values to be plotted Name of first slice (first value) Name of second slice (second value) Name of third slice (third value) Colors of the slices Draw as 3D pie Format of the labels Detached slices? Position of the legend Margin reserved for the legend Border of the chart Background | new Title("..."); legend.background=Color.white; legend.verticalLayout=false; piePlotter=new PiePlotter(); serie=new PieDataSerie(values,styles,detachedFlags,pieLabels); see values in the constructor of PieDataSerie legend.addItem("Products",GraphicsProvider.getColor(ChartColor.RED)); see styles in the constructor of PieDataSerie piePlotter.effect3D=true; piePlotter.labelFormat="#VALUE# (#PERCENTAGE#) "; see pieLabels in the constructor of PieDataSerie see detachedFlags in the constructor of PieDataSerie

The SERIE_TOGETHER_1 parameters is used to control which slices are detached from the pie.

Parameters | Description | Equivalent java class/property
SERIE_TOGETHER_1=true|true|true | No detached slices | see detachedFlags in the constructor of PieDataSerie

The size of the pie can be changed using the PIECHART_RADIUS parameter.

Parameters | Description | Equivalent java class/property
PIECHART_RADIUS=0.5 | Half of the size of the normal size (default is 1) | piePlotter.radiusModifier=0.5;

The SERIE_DISTCENTER_1 defines the position of the labels:

Parameters | Description | Equivalent java class/property
SERIE_DISTCENTER_1=0.5 | default is 1. | serie.textDistanceToCenter=0.5

You can also place the labels outside the pie and draw lines from the slice to the labels:

Parameters | Description | Equivalent java class/property
PIE_LABEL_LINE=0.2|0x0|NORMAL SERIE_DISTCENTER_1=1.4 | Draw label lines Draw labels outside the pie | piePlotter.labelLine=new LineStyle(...); serie.textDistanceToCenter=1.4

If you set PIECHART_3D to false, a 2D pie will be painted:

Parameters | Description | Equivalent java class/property
PIECHART_3D=false PIE_BORDER=0.2|0x0|NORMAL | 2D pie Border of the pie, only for 2D pie that do not have detached slices. | piePlotter.effect3D=false; piePlotter.border =new LineStyle(...);

You can define the format of the labels using PIE_LABEL_FORMAT. The following variables can be use: #VALUE#, #PERCENTAGE# and #LABEL#. For example, the following format: "#LABEL# = #PERCENTAGE#" would produce this output: "ItemA = 35%". See SERIE_LABELS parameter.

Parameters | Description | Equivalent java class/property
PIE_LABEL_FORMAT=#LABEL# = #PERCENTAGE# SERIE_LABELS_1=Products|Services|Other | Format of the labels in the pie Values for the #LABEL# variable | piePlotter.labelFormat see pieLabels in the constructor of PieDataSerie

SERIE_PERCENTAGES_1: "True" or "False". If true the labels will be displayed as percentage, if false as absolute value.Only used if the PIE_LABEL_FORMAT parameter is empty.

Parameters | Description | Equivalent java class/property
SERIE_PERCENTAGES_1=FALSE | Absolute values will be displayed as label (not percentages). | serie.drawPercentages=false;