GraphStyleSpec.fromJson constructor

GraphStyleSpec.fromJson(
  1. Json j
)

Implementation

factory GraphStyleSpec.fromJson(Json j) => GraphStyleSpec(
      background: graphColor(j['background'], const Color(0xFFFFFFFF)),
      grid: graphColor(j['grid'], const Color(0x14000000)),
      text: graphColor(j['text'], const Color(0xFF6B7280)),
      crosshair: graphColor(j['crosshair'], const Color(0xFF9CA3AF)),
      tag: graphColor(j['tag'], const Color(0xFF111827)),
      tagText: graphColor(j['tagText'], const Color(0xFFFFFFFF)),
      separator: graphColor(j['separator'], const Color(0x1F000000)),
      fontSize: _d(j['fontSize'], 11),
      fontFamily: j['fontFamily'] is String ? j['fontFamily']! as String : null,
      fontFamilyFallback: [for (final f in _l(j['fontFamilyFallback'])) if (f is String) f],
      topInset: _d(j['topInset'], 0),
      ink: graphColor(j['ink'], const Color(0xFF111827)),
      tooltip: graphColor(j['tooltip'], const Color(0xFFFFFFFF)),
      tooltipText: graphColor(j['tooltipText'], const Color(0xFF111827)),
      tooltipBorder: graphColor(j['tooltipBorder'], const Color(0x1F000000)),
      palette: _l(j['palette']).isEmpty
          ? graphPalette
          : [for (final c in _l(j['palette'])) graphColor(c, const Color(0xFF2962FF))],
    );