StackedBarChartComponent constructor

StackedBarChartComponent(
  1. RenderComponent parent,
  2. String id, {
  3. double maxLabelWidthX = 50,
  4. double maxLabelWidthY = 50,
  5. Set<String>? barLabels,
  6. double barWidth = 15,
  7. double barMargin = 45,
  8. Set<String>? labelsX,
  9. int? labelCountY,
  10. double? labelMinY,
  11. double? labelMaxY,
  12. String labelFormatY(
    1. double
    )?,
  13. String? css = 'stackedbar',
  14. double gridLineWidth = 1,
  15. double aspectRatio = 1.5,
  16. double textMargin = 15,
  17. String gridLineStrokeStyle = '#d7d7d7',
  18. String labelFillStyle = '#aaaaaa',
  19. String labelFontStyle = '14px sans-serif',
  20. String captionBgColor = '#2d2d2d',
  21. String captionFgColor = 'white',
  22. 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>
  ''';
}