A chart rendering view does not render any chart title, footer or description labels. LabeledChart decorates a simple chart view with appropriate labels. Label font and color are automatically configured, depending on where the label is added. If a label is added to the left or right side of the chart, the label is displayed in vertical orientation. LabeledChart uses DecoratedView to arrange the labels around the chart.
DecoratedView arranges views in a similar way the BorderLayout in java.awt does. Views are arranged on top, below and on the left and right sides of the chart and occupy as much space as their preferred size requires. But DecoratedView differs from the BorderLayout: it may overlap the surrounding views with the center view. Each side view can be specified with an optional attribute, determining the overlap percentage. If the attribute is set to 50%, the side component overlaps the central one half-way. This feature allows nice overlay of the legend on top of the chart.
Creating LabeledChart:
1 | Chart chart = new Chart2D(); ... //setting chart objects and so on LabeledChart lChart = new LabeledChart(chart); lChart.setTitle("Demo"); //setting title for labeled chart |