toJson method

Json toJson()

Implementation

Json toJson() => {
      'type': type,
      if (y.isNotEmpty) 'y': y,
      if (open.isNotEmpty) 'open': open,
      if (high.isNotEmpty) 'high': high,
      if (low.isNotEmpty) 'low': low,
      if (close.isNotEmpty) 'close': close,
      'color': _hex(color),
      'upColor': _hex(upColor),
      'downColor': _hex(downColor),
      'width': width,
      'fillOpacity': fillOpacity,
      'fade': fade,
      'curved': curved,
      if (overlay != null) 'overlay': overlay,
      if (segmentBy.isNotEmpty) 'segmentBy': segmentBy,
      'dimInactive': dimInactive,
      'endDot': endDot,
      if (endDotColor != null) 'endDotColor': _hex(endDotColor!),
      'pulse': pulse,
      if (name.isNotEmpty) 'name': name,
      if (stack != null) 'stack': stack,
      if (radius != 0) 'radius': radius,
      if (colorField.isNotEmpty) 'colorField': colorField,
      if (colors.isNotEmpty) 'colors': [for (final c in colors) _hex(c)],
      if (inner != 0) 'inner': inner,
      if (gap != 0) 'gap': gap,
      if (startAngle != 0) 'startAngle': startAngle,
      if (labels) 'labels': labels,
      if (fillTo != null) 'fillTo': _hex(fillTo!),
      if (dots != 0) 'dots': dots,
      if (center.isNotEmpty) 'center': center,
      if (centerLabel.isNotEmpty) 'centerLabel': centerLabel,
    };