decodeLinePointHighlighter<D> static method

LinePointHighlighter<D>? decodeLinePointHighlighter<D>(
  1. dynamic map, {
  2. bool validate = true,
})

Decodes the object from a Map-like dynamic structure. This expects the JSON format to be of the following structure:

{
  "dashPattern": <List<int>>,
  "defaultRadiusPx": <double>,
  "drawFollowLinesAcrossChart": <bool>,
  "radiusPaddingPx": <double>,
  "selectionModelType": <SelectionModelType>,
  "showHorizontalFollowLine": <LinePointHighlighterFollowLineType>,
  "showVerticalFollowLine": <LinePointHighlighterFollowLineType>,
  "symbolRenderer": <SymbolRenderer>
}

See also:

Implementation

static charts.LinePointHighlighter<D>? decodeLinePointHighlighter<D>(
  dynamic map, {
  bool validate = true,
}) {
  charts.LinePointHighlighter<D>? result;

  if (map is charts.LinePointHighlighter<D>) {
    result = map;
  } else if (map != null) {
    assert(SchemaValidator.validate(
      schemaId: '$_baseSchemaUrl/line_point_highlighter',
      value: map,
      validate: validate,
    ));
    result = charts.LinePointHighlighter<D>(
      dashPattern: map['dashPattern'] == null
          ? null
          : List<int>.from(
              map['dashPattern'].map((e) => JsonClass.parseInt(e)!),
            ),
      defaultRadiusPx: JsonClass.parseDouble(map['defaultRadiusPx']),
      drawFollowLinesAcrossChart: map['drawFollowLinesAcrossChart'] == null
          ? null
          : JsonClass.parseBool(map['drawFollowLinesAcrossChart']),
      radiusPaddingPx: JsonClass.parseDouble(map['radiusPaddingPx']),
      selectionModelType: decodeSelectionModelType(
        map['selectionModelType'],
        validate: false,
      ),
      showHorizontalFollowLine: decodeLinePointHighlighterFollowLineType(
        map['showHorizontalFollowLine'],
        validate: false,
      ),
      showVerticalFollowLine: decodeLinePointHighlighterFollowLineType(
        map['showVerticalFollowLine'],
        validate: false,
      ),
      symbolRenderer: decodeSymbolRenderer(
        map['symbolRenderer'],
        validate: false,
      ),
    );
  }

  return result;
}