decodeBarLabelPlacement static method
Expects the map
to be either a common.BarLabelPlacement
or a String
containing one of the following values:
followMeasureAxis
opposeAxisBaseline
Implementation
static common.BarLabelPlacement? decodeBarLabelPlacement(
dynamic map, {
bool validate = true,
}) {
common.BarLabelPlacement? result;
if (map is common.BarLabelPlacement) {
result = map;
} else if (map != null) {
assert(SchemaValidator.validate(
schemaId: '$_baseSchemaUrl/bar_label_placement',
value: map,
validate: validate,
));
switch (map) {
case 'followMeasureAxis':
result = common.BarLabelPlacement.followMeasureAxis;
break;
case 'opposeAxisBaseline':
result = common.BarLabelPlacement.opposeAxisBaseline;
break;
default:
throw Exception('Unknown [BarLabelPlacement] encountered: [$map]');
}
}
return result;
}