getLabelCountY method

int getLabelCountY()

Gets how many labels the graph should display in Y axis. If _initialLabelCountY is not supplied, which means labelCountY was not supplied in the constructor, the label counts is dynamic (depending on canvas height).

Implementation

int getLabelCountY() {
  if (_initialLabelCountY != null) return _initialLabelCountY!;

  var divider = 45;
  if (_svgElem.clientHeight < 600) {
    divider = 45;
  } else if (_svgElem.clientHeight < 1200) {
    divider = 80;
  } else {
    divider = 100;
  }

  return max((_svgElem.clientHeight/divider).truncate(), 2);
}