createCanvases method

void createCanvases()

Implementation

void createCanvases() {
  chartCanvas = CanvasElement(
      width: container.clientWidth, height: container.clientHeight);
  mouseCanvas = CanvasElement(
      width: container.clientWidth, height: container.clientHeight);
  final unkCtx = chartCanvas!.getContext('2d');
  if (unkCtx is CanvasRenderingContext2D) {
    ctx = unkCtx;
  } else {
    throw Exception('Could not get CanvasRenderingContext2D');
  }
  final unkMouseCtx = mouseCanvas!.getContext('2d');
  if (unkMouseCtx is CanvasRenderingContext2D) {
    mouseCtx = unkMouseCtx;
  } else {
    throw Exception('Could not get CanvasRenderingContext2D');
  }
  container.style.position = 'relative';
  width = chartCanvas!.width!;
  height = chartCanvas!.height!;
  if (chartCanvas != null) {
    chartCanvas!.style
      ..position = 'absolute'
      ..top = '0'
      ..left = '0'
      ..bottom = '0'
      ..right = '0';
  }
  if (mouseCanvas != null) {
    mouseCanvas!.style
      ..position = 'absolute'
      ..top = '0'
      ..left = '0'
      ..bottom = '0'
      ..right = '0'
      ..zIndex = '9';
  }
}