StackedBarChartComponent constructor
StackedBarChartComponent(
- RenderComponent parent,
- String id, {
- double maxLabelWidthX = 50,
- double maxLabelWidthY = 50,
- Set<
String> ? barLabels, - double barWidth = 15,
- double barMargin = 45,
- Set<
String> ? labelsX, - int? labelCountY,
- double? labelMinY,
- double? labelMaxY,
- String labelFormatY()?,
- String? css = 'stackedbar',
- double gridLineWidth = 1,
- double aspectRatio = 1.5,
- double textMargin = 15,
- String gridLineStrokeStyle = '#d7d7d7',
- String labelFillStyle = '#aaaaaa',
- String labelFontStyle = '14px sans-serif',
- String captionBgColor = '#2d2d2d',
- String captionFgColor = 'white',
- String captionFontFamily = 'sans-serif',
Implementation
StackedBarChartComponent(super.parent, super.id, {
this.maxLabelWidthX = 50,
this.maxLabelWidthY = 50,
Set<String>? barLabels,
this.barWidth = 15,
this.barMargin = 45,
Set<String>? labelsX,
int? labelCountY,
double? labelMinY,
double? labelMaxY,
String Function(double)? labelFormatY,
String? css = 'stackedbar',
super.gridLineWidth,
super.aspectRatio,
super.textMargin,
super.gridLineStrokeStyle,
super.labelFillStyle,
super.labelFontStyle,
super.captionBgColor,
super.captionFgColor,
super.captionFontFamily,
}) :
barLabels = barLabels ?? {},
_initialLabelCountY = labelCountY,
_initialLabelMinY = labelMinY,
_initialLabelMaxY = labelMaxY,
labelFormatY = labelFormatY ?? _defaultLabelFormat {
// Add empty data point in some X point that is defined in labels, but
// do not have any points.
labelsX?.forEach((element) {
if (_dataPoints[element] == null) {
_dataPoints[element] = {};
}
});
if (labelsX != null) this.labelsX = LinkedHashSet.from(labelsX);
baseInnerHtml = '''
<div id="$id" class="$css" style="aspect-ratio: $aspectRatio;position: relative;overflow-x: auto;width: 100%;">
<svg id="$id-svg" xmlns="http://www.w3.org/2000/svg" class="$css-svg" width="100%" height="100%" style="display: block;">
<g id="$id-svg-grid"></g>
<g id="$id-svg-label"></g>
<g id="$id-svg-points"></g>
</svg>
</div>
''';
}