LineChartLayoutSection.fromJson constructor

LineChartLayoutSection.fromJson(
  1. Map<String, dynamic> json, {
  2. LineChartLayoutSection? defaults,
})

Parses chartsLayout.line from HostConfig JSON.

Implementation

factory LineChartLayoutSection.fromJson(
  Map<String, dynamic> json, {
  LineChartLayoutSection? defaults,
}) {
  final base = defaults ?? ChartsLayoutConfig.defaults.line;
  return LineChartLayoutSection(
    height: (json['height'] as num?)?.toDouble() ?? base.height,
    emptyMinX: (json['emptyMinX'] as num?)?.toDouble() ?? base.emptyMinX,
    emptyMaxX: (json['emptyMaxX'] as num?)?.toDouble() ?? base.emptyMaxX,
    emptyMinY: (json['emptyMinY'] as num?)?.toDouble() ?? base.emptyMinY,
    emptyMaxY: (json['emptyMaxY'] as num?)?.toDouble() ?? base.emptyMaxY,
    degenerateRangeBump:
        (json['degenerateRangeBump'] as num?)?.toDouble() ??
        base.degenerateRangeBump,
    zeroRangeFallback:
        (json['zeroRangeFallback'] as num?)?.toDouble() ??
        base.zeroRangeFallback,
    yAxisPaddingFactor:
        (json['yAxisPaddingFactor'] as num?)?.toDouble() ??
        base.yAxisPaddingFactor,
    isCurved: json['isCurved'] as bool? ?? base.isCurved,
    barWidth: (json['barWidth'] as num?)?.toDouble() ?? base.barWidth,
    isStrokeCapRound:
        json['isStrokeCapRound'] as bool? ?? base.isStrokeCapRound,
    showDots: json['showDots'] as bool? ?? base.showDots,
    showAreaBelow: json['showAreaBelow'] as bool? ?? base.showAreaBelow,
    showTitles: json['showTitles'] as bool? ?? base.showTitles,
    showRightTitles: json['showRightTitles'] as bool? ?? base.showRightTitles,
    showTopTitles: json['showTopTitles'] as bool? ?? base.showTopTitles,
    showGrid: json['showGrid'] as bool? ?? base.showGrid,
    showBorder: json['showBorder'] as bool? ?? base.showBorder,
    borderColor:
        parseHexColor(json['borderColor']?.toString()) ?? base.borderColor,
    borderWidth:
        (json['borderWidth'] as num?)?.toDouble() ?? base.borderWidth,
  );
}