PartitionPieChartConfig.fromJson constructor

PartitionPieChartConfig.fromJson(
  1. Map<String, dynamic> j
)

Implementation

factory PartitionPieChartConfig.fromJson(Map<String, dynamic> j) {
  final directMain = _pieSliceMaps(PieJson.mapList(j['mainSlices']));
  final directSub = _pieSliceMaps(PieJson.mapList(j['subSlices']));
  final main = directMain.isNotEmpty
      ? directMain
      : _partitionSeriesSlices(j, subSlices: false);
  final sub = directSub.isNotEmpty
      ? directSub
      : _partitionSeriesSlices(j, subSlices: true);
  return PartitionPieChartConfig(
    mainSlices: main,
    partitionIndex: _partitionIndex(j['partitionIndex'], main.length),
    subSlices: sub,
    padAngle: PieJson.angleGap(j['padAngle'], 0.02),
    title: PieJson.title(j['title']),
    tooltip: PieJson.tooltip(j['tooltip']),
    legend: PieJson.legend(j['legend']),
    toolbox: PieJson.toolbox(j['toolbox']),
    grid: PieJson.grid(j['grid']),
  );
}