public final class Percentage extends Object
Modifier and Type | Method and Description |
---|---|
static double |
compute(IsChart chart,
double value,
ScriptableContext context)
Computes the percentage of the value based on the data of datasets.
|
static double |
compute(IsChart chart,
double value,
ScriptableContext context,
boolean stacked)
Computes the percentage of the value based on the data of datasets.
|
public static double compute(IsChart chart, double value, ScriptableContext context)
DataPoint
, it
uses the DataPoint.getY()
value to compute the percentage. The stack is ignored.chart
- chart instancevalue
- current value to be evaluatedcontext
- data labels plugin contextDouble.NaN
.public static double compute(IsChart chart, double value, ScriptableContext context, boolean stacked)
DataPoint
, it
uses the DataPoint.getY()
value to compute the percentage.chart
- chart instancevalue
- current value to be evaluatedcontext
- data labels plugin contextstacked
- if true
, it calculates the total at the same data index (cross datasets), otherwise if
false
it calculates the total at the same dataset index (single dataset)Double.NaN
.