decodeBucketingAxisSpec static method
Decodes the object from a Map-like dynamic structure. This expects the JSON format to be of the following structure:
{
"renderSpec": <RenderSpec<num>>,
"showAxisLine": <bool>,
"showBucket": <bool>,
"threshold": <double>,
"tickFormatterSpec": <NumericTickFormatterSpec>,
"tickProviderSpec": <NumericTickProviderSpec>,
"viewport": <NumericExtents>
}
See also:
Implementation
static charts.BucketingAxisSpec? decodeBucketingAxisSpec(
dynamic map, {
bool validate = true,
}) {
charts.BucketingAxisSpec? result;
if (map is charts.BucketingAxisSpec) {
result = map;
} else if (map != null) {
assert(SchemaValidator.validate(
schemaId: '$_baseSchemaUrl/bucketing_axis_spec',
value: map,
validate: validate,
));
result = charts.BucketingAxisSpec(
renderSpec: decodeRenderSpec<num>(
map['renderSpec'],
validate: false,
),
showAxisLine: map['showAxisLine'] == null
? null
: JsonClass.parseBool(map['showAxisLine']),
showBucket: map['showBucket'] == null
? null
: JsonClass.parseBool(map['showBucket']),
threshold: JsonClass.parseDouble(map['threshold']),
tickFormatterSpec: decodeNumericTickFormatterSpec(
map['tickFormatterSpec'],
validate: false,
),
tickProviderSpec: decodeNumericTickProviderSpec(
map['tickProviderSpec'],
validate: false,
),
viewport: decodeNumericExtents(
map['viewport'],
validate: false,
),
);
}
return result;
}