ceTe Software Help Library for Java August - 2020
DynamicPDF Generator for Java / Programming with Generator for Java / Charts / Chart Elements / Data Labels
In This Topic
    Data Labels
    In This Topic

    Data Labels are labels that provide additional information about data markers, which represent single data values. They appear slightly offset from where the value is plotted. There are four different types of data labels

    The 100% chart uses PercentageDataLabel to display details such as the XAxis value, the YAxis value, the name of the series and its value in percentage format.

    The below code shows how to add PercentageDataLabel to a DateTime100PercentStackedLine series.

    [Java]
         DateTime100PercentStackedLineSeriesElement seriesElement = new DateTime100PercentStackedLineSeriesElement("series name");
         seriesElement.setDataLabel(new PercentageDataLabel(true, true, true, true));
    
    The XYScatter chart uses XYScatterDataLabel to display the XAxis value, the YAxis value and the series name.

    The below code shows how to create and add XYScatterDataLabel to a XYScatter series.

    [Java]
         XYScatterSeries xyScatterSeries = new XYScatterSeries("series name");
         xyScatterSeries.setDataLabel(new XYScatterDataLabel(true, true, true));
    
    All charts that have Numeric, DateTime or Indexed axis use ValuePositionDataLabel to display the XAxis value, the YAxis value and the series name.

    The below code shows how to add ValuePositionDataLabel to a DateTimeLine series.

    [Java]
         DateTimeLineSeries lineSeries = new DateTimeLineSeries("series name");
         lineSeries.setDataLabel(new ValuePositionDataLabel(true, true, true));
    
    The PieSeries uses ScalarDataLabel to display the PieSeries element value, PieSeries element name and PieSeries element value in percentage format. ScalarDataLabelPosition class can be used to specify whether the ScalarDataLabe is added inside or outside the circle. By default it appears outside the circle.

    The below code shows how to add ScalarDataLabel to a PieSeries.

    [Java]
         PieSeries pieSeries = new PieSeries();
         pieSeries.setDataLabel(new ScalarDataLabel(true,true,true));
    
    See Also