LineGraphComponent constructor
LineGraphComponent(
- RenderComponent parent,
- String id, {
- Map<
String, List< points = const {},DataPoint> > - int? labelCountX,
- int? labelCountY,
- double? labelMinX,
- double? labelMinY,
- double? labelMaxX,
- double? labelMaxY,
- double maxLabelWidthX = 50,
- double maxLabelWidthY = 20,
- double textMargin = 15,
- String labelFormatX(
- double label
- String labelFormatY(
- double label
- double aspectRatio = 1.5,
- double gridLineWidth = 1,
- String gridLineStrokeStyle = '#d7d7d7',
- String labelFillStyle = '#aaaaaa',
- String labelFontStyle = '14px sans-serif',
- Map<
String, double> dotRadius = const {keyAllGraph : 6}, - Map<
String, double> hoverDotRadiusOffset = const {keyAllGraph : 0}, - Map<
String, String> dotFillStyle = const {keyAllGraph : 'white'}, - Map<
String, String> dotStrokeStyle = const {keyAllGraph : '#2d2d2d'}, - Map<
String, double> dotStrokeWidth = const {keyAllGraph : 1}, - Map<
String, String> dataLineStrokeStyle = const {keyAllGraph : '#aaaaaa'}, - Map<
String, double> dataLineWidth = const {keyAllGraph : 2}, - Map<
String, String> shadingFillStyle = const {keyAllGraph : 'rgba(0, 0, 0, 0.2)'}, - String captionBgColor = '#2d2d2d',
- String captionFgColor = 'white',
- String captionFontFamily = 'sans-serif',
- bool drawGridY = false,
- double minWidth = 500,
- bool minWidthOverride = false,
- dynamic onHover()?,
- dynamic onHoverOut()?,
Implementation
LineGraphComponent(super.parent, super.id,
{Map<String, List<DataPoint>> points = const {},
int? labelCountX,
int? labelCountY,
double? labelMinX,
double? labelMinY,
double? labelMaxX,
double? labelMaxY,
super.maxLabelWidthX,
super.maxLabelWidthY,
super.textMargin,
super.labelFormatX = _defaultLabelFormat,
super.labelFormatY = _defaultLabelFormat,
super.aspectRatio,
super.gridLineWidth,
super.gridLineStrokeStyle,
super.labelFillStyle,
super.labelFontStyle,
this.dotRadius = const {keyAllGraph: 6},
this.hoverDotRadiusOffset = const {keyAllGraph: 0},
this.dotFillStyle = const {keyAllGraph: 'white'},
this.dotStrokeStyle = const {keyAllGraph: '#2d2d2d'},
this.dotStrokeWidth = const {keyAllGraph: 1},
this.dataLineStrokeStyle = const {keyAllGraph: '#aaaaaa'},
this.dataLineWidth = const {keyAllGraph: 2},
this.shadingFillStyle = const {keyAllGraph: 'rgba(0, 0, 0, 0.2)'},
super.captionBgColor,
super.captionFgColor,
super.captionFontFamily,
super.drawGridY,
this.minWidth = 500,
this.minWidthOverride = false,
this.onHover,
this.onHoverOut
}) {
_dataPoints = points.map(
(key, value) =>
MapEntry<String, SplayTreeMap<double, double>>(
key,
SplayTreeMap<double, double>.fromIterable(value, key: (e) => e.x, value: (e) => e.y)
)
);
if (!dotRadius.containsKey(keyAllGraph)) dotRadius[keyAllGraph] = 6;
if (!hoverDotRadiusOffset.containsKey(keyAllGraph)) hoverDotRadiusOffset[keyAllGraph] = 0;
if (!dotFillStyle.containsKey(keyAllGraph)) dotFillStyle[keyAllGraph] = 'white';
if (!dotStrokeStyle.containsKey(keyAllGraph)) dotStrokeStyle[keyAllGraph] = '#2d2d2d';
if (!dotStrokeWidth.containsKey(keyAllGraph)) dotStrokeWidth[keyAllGraph] = 1;
if (!dataLineStrokeStyle.containsKey(keyAllGraph)) dataLineStrokeStyle[keyAllGraph] = '#aaaaaa';
if (!dataLineWidth.containsKey(keyAllGraph)) dataLineWidth[keyAllGraph] = 2;
if (!shadingFillStyle.containsKey(keyAllGraph)) shadingFillStyle[keyAllGraph] = 'rgba(0, 0, 0, 0.2)';
_initialLabelCountX = labelCountX;
_initialLabelCountY = labelCountY;
_initialLabelMinX = labelMinX;
_initialLabelMinY = labelMinY;
_initialLabelMaxX = labelMaxX;
_initialLabelMaxY = labelMaxY;
_setMinMaxXY();
}