Skip to content

Commit 43d2af5

Browse files
committed
Document chart usage
1 parent 723281e commit 43d2af5

File tree

14 files changed

+226
-46
lines changed

14 files changed

+226
-46
lines changed

CodenameOne/src/com/codename1/charts/views/BarChart.java

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,30 @@
3131
import java.util.List;
3232

3333

34-
/**
35-
* The bar chart rendering class.
36-
*/
37-
public class BarChart extends XYChart {
34+
/**
35+
* Renders a bar chart based on an {@link XYMultipleSeriesDataset}.
36+
* <p>
37+
* Create an instance together with a matching {@link XYMultipleSeriesRenderer}
38+
* and wrap it in a {@link com.codename1.charts.ChartComponent} to display it in
39+
* the UI. A minimal setup looks like this:
40+
*
41+
* <pre>
42+
* XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
43+
* dataset.addSeries(mySeries);
44+
*
45+
* XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
46+
* renderer.addSeriesRenderer(new XYSeriesRenderer());
47+
*
48+
* BarChart chart = new BarChart(dataset, renderer, BarChart.Type.DEFAULT);
49+
* Form form = new Form(new BorderLayout());
50+
* form.add(BorderLayout.CENTER, new ChartComponent(chart));
51+
* form.show();
52+
* </pre>
53+
*
54+
* The {@link Type} supplied to the constructor controls whether the bars are
55+
* rendered in their default style, stacked or heaped.
56+
*/
57+
public class BarChart extends XYChart {
3858
/** The constant to identify this chart type. */
3959
public static final String TYPE = "Bar";
4060
/** The legend shape width. */

CodenameOne/src/com/codename1/charts/views/BubbleChart.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,17 @@
2727
import java.util.List;
2828

2929

30-
/**
31-
* The bubble chart rendering class.
32-
*/
33-
public class BubbleChart extends XYChart {
30+
/**
31+
* Displays series of {@link XYValueSeries} entries as proportional bubbles on
32+
* top of an {@link XYChart} plot.
33+
* <p>
34+
* Combine the chart with an {@link XYMultipleSeriesDataset} that contains one
35+
* or more {@link XYValueSeries} instances and supply an
36+
* {@link XYMultipleSeriesRenderer}. The resulting {@code BubbleChart} can be
37+
* wrapped in a {@link com.codename1.charts.ChartComponent} to embed it inside a
38+
* Codename One UI.
39+
*/
40+
public class BubbleChart extends XYChart {
3441
/** The constant to identify this chart type. */
3542
public static final String TYPE = "Bubble";
3643
/** The legend shape width. */

CodenameOne/src/com/codename1/charts/views/CombinedXYChart.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,18 @@
2828
import java.util.List;
2929

3030

31-
/**
32-
* The combined XY chart rendering class.
33-
*/
34-
public class CombinedXYChart extends XYChart {
31+
/**
32+
* Aggregates multiple {@link XYChart} implementations into a single plot so
33+
* different series can be visualised using different renderers (for example a
34+
* line overlaid on top of a bar chart).
35+
* <p>
36+
* Provide the constructor with an {@link XYMultipleSeriesDataset}, a matching
37+
* {@link XYMultipleSeriesRenderer} and an array of
38+
* {@link XYCombinedChartDef} instances that describe which inner chart type
39+
* should render each data series. The combined chart can then be wrapped in a
40+
* {@link com.codename1.charts.ChartComponent} for display.
41+
*/
42+
public class CombinedXYChart extends XYChart {
3543

3644
private final XYCombinedChartDef[] chartDefinitions;
3745

CodenameOne/src/com/codename1/charts/views/CubicLineChart.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,16 @@
2727
import java.util.List;
2828

2929

30-
/**
31-
* The interpolated (cubic) line chart rendering class.
32-
*/
33-
public class CubicLineChart extends LineChart {
30+
/**
31+
* Draws smooth curves through XY series values using cubic interpolation.
32+
* <p>
33+
* Use this chart when you want to emphasise the trend between points rather
34+
* than the raw straight-line segments of {@link LineChart}. Supply the
35+
* {@link XYMultipleSeriesDataset} and {@link XYMultipleSeriesRenderer} as usual
36+
* and pass an optional smoothness factor to control how tightly the curve
37+
* follows the provided data points.
38+
*/
39+
public class CubicLineChart extends LineChart {
3440
/** The chart type. */
3541
public static final String TYPE = "Cubic";
3642

CodenameOne/src/com/codename1/charts/views/DialChart.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,15 @@
2626
import com.codename1.ui.Component;
2727

2828

29-
/**
30-
* The dial chart rendering class.
31-
*/
32-
public class DialChart extends RoundChart {
29+
/**
30+
* Presents values from a {@link CategorySeries} as gauges on a dial.
31+
* <p>
32+
* Configure the dial appearance via a {@link DialRenderer} and supply both the
33+
* dataset and renderer to the constructor. Dial charts are typically wrapped in
34+
* a {@link com.codename1.charts.ChartComponent} so they can be placed inside
35+
* regular Codename One layouts.
36+
*/
37+
public class DialChart extends RoundChart {
3338
/** The radius of the needle. */
3439
private static final int NEEDLE_RADIUS = 10;
3540
/** The series renderer. */

CodenameOne/src/com/codename1/charts/views/DoughnutChart.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,16 @@
2828
import java.util.List;
2929

3030

31-
/**
32-
* The doughnut chart rendering class.
33-
*/
34-
public class DoughnutChart extends RoundChart {
31+
/**
32+
* Visualises a {@link MultipleCategorySeries} as concentric rings that share a
33+
* common centre (also known as a doughnut chart).
34+
* <p>
35+
* Each category in the dataset is drawn as a separate ring, making it suitable
36+
* for representing hierarchical proportions. Construct the chart with the
37+
* dataset and a {@link DefaultRenderer} and wrap it in a
38+
* {@link com.codename1.charts.ChartComponent} to place it on screen.
39+
*/
40+
public class DoughnutChart extends RoundChart {
3541
/** The series dataset. */
3642
private final MultipleCategorySeries mDataset;
3743
/** A step variable to control the size of the legend shape. */

CodenameOne/src/com/codename1/charts/views/LineChart.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@
2828
import java.util.List;
2929

3030

31-
/**
32-
* The line chart rendering class.
33-
*/
34-
public class LineChart extends XYChart {
31+
/**
32+
* Plots series of X/Y points using straight line segments.
33+
* <p>
34+
* Supply the chart with an {@link XYMultipleSeriesDataset} and configure its
35+
* appearance via an {@link XYMultipleSeriesRenderer}. The chart is commonly
36+
* wrapped in a {@link com.codename1.charts.ChartComponent} before being added
37+
* to a Codename One form.
38+
*/
39+
public class LineChart extends XYChart {
3540
/** The constant to identify this chart type. */
3641
public static final String TYPE = "Line";
3742
/** The legend shape width. */

CodenameOne/src/com/codename1/charts/views/PieChart.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333

3434

3535
/**
36-
* The pie chart rendering class.
36+
* Shows each value from a {@link CategorySeries} as a slice of a circle.
37+
* <p>
38+
* Combine this chart with a {@link DefaultRenderer} to control colours, labels
39+
* and gradients. The resulting {@code PieChart} can be embedded in a form via a
40+
* {@link com.codename1.charts.ChartComponent}.
3741
*/
3842
public class PieChart extends RoundChart {
3943
/** Handles returning values when tapping on PieChart. */

CodenameOne/src/com/codename1/charts/views/RadarChart.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@
2828
import java.util.List;
2929

3030
/**
31-
* The radar chart rendering class.
31+
* Draws multi-dimensional data as a web chart (also known as a radar or spider
32+
* chart).
33+
* <p>
34+
* The chart consumes an {@link AreaSeries} where each category represents an
35+
* axis radiating from the centre. Configure colours and labelling through a
36+
* {@link DefaultRenderer} and wrap the instance in a
37+
* {@link com.codename1.charts.ChartComponent} to present it inside your UI.
3238
*/
3339
public class RadarChart extends RoundChart {
3440

CodenameOne/src/com/codename1/charts/views/RangeBarChart.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,16 @@
2626
import java.util.List;
2727

2828

29-
/**
30-
* The range bar chart rendering class.
31-
*/
32-
public class RangeBarChart extends BarChart {
29+
/**
30+
* Extends {@link BarChart} to support values that represent ranges rather than
31+
* single points. Each bar is drawn from the lower value to the upper value in
32+
* the dataset.
33+
* <p>
34+
* Use this chart with an {@link XYMultipleSeriesDataset} containing
35+
* {@link XYSeries} instances where consecutive entries form the minimum/maximum
36+
* pair for a category.
37+
*/
38+
public class RangeBarChart extends BarChart {
3339
/** The chart type. */
3440
public static final String TYPE = "RangeBar";
3541

0 commit comments

Comments
 (0)