inferSeriesDataShape function
Detect the dominant data shape from JSON chart config.
Implementation
ChartSeriesDataShape inferSeriesDataShape(Map<String, dynamic> json) {
final declaredType = _tryParseCanonicalType(json['type']);
final declaredShape = declaredType == null
? null
: targetSeriesDataShape(declaredType);
if (declaredShape != null &&
declaredShape != ChartSeriesDataShape.unknown &&
_dataCanRepresentDeclaredShape(json, declaredShape)) {
return declaredShape;
}
if (_hasHierarchicalData(json)) return ChartSeriesDataShape.hierarchical;
if (_hasGraphData(json)) return ChartSeriesDataShape.graph;
if (_hasFlowData(json)) return ChartSeriesDataShape.flow;
if (_hasFinancialData(json)) return ChartSeriesDataShape.financial;
if (_hasGeospatialData(json)) return ChartSeriesDataShape.geospatial;
if (_hasCalendarData(json)) return ChartSeriesDataShape.calendar;
if (_hasMatrixData(json)) return ChartSeriesDataShape.matrix;
if (_hasPieLikeData(json)) return ChartSeriesDataShape.pieLike;
if (_hasCartesianData(json)) return ChartSeriesDataShape.cartesian;
return ChartSeriesDataShape.unknown;
}