Class PercentageCallback

  • All Implemented Interfaces:
    FormatterCallback

    public final class PercentageCallback
    extends Object
    implements FormatterCallback
    Formatter implementation for DataLabelsPlugin plugin in order to provide the percentage of the value.
    Setting this object to formatter callback of DataLabelsPlugin options, it will return the percentage for each data index per dataset.
    Author:
    Andrea "Stock" Stocchero
    • Constructor Detail

      • PercentageCallback

        public PercentageCallback()
        Creates the formatter using the default values. The precision is DEFAULT_PRECISION and stacked is false.
      • PercentageCallback

        public PercentageCallback​(int precision)
        Creates the formatter using the argument as number precision. The stacked is false.
        Parameters:
        precision - number precision to apply
      • PercentageCallback

        public PercentageCallback​(boolean stacked)
        Creates the formatter using the argument as flag to compute the percentage on stacked datasets. The format is DEFAULT_PRECISION.
        Parameters:
        stacked - if true computes the percentage on stacked datasets.
      • PercentageCallback

        public PercentageCallback​(int precision,
                                  boolean stacked)
        Creates the formatter using the arguments as number format and as flag to compute the percentage on stacked datasets.
        Parameters:
        precision - precision to apply
        stacked - if true computes the percentage on stacked datasets.
    • Method Detail

      • getPrecision

        public int getPrecision()
        Returns the number precision to apply.
        Returns:
        the number precision to apply
      • isStacked

        public boolean isStacked()
        Returns true if it computes the percentage on stacked datasets.
        Returns:
        if true computes the percentage on stacked datasets.