Chart constructor

Chart(
  1. Element container
)

Creates a chart given a container.

If the CSS position of container is 'static', it will be changed to 'relative'.

Implementation

Chart(this.container) {
  if (container.getComputedStyle().position == 'static') {
    container.style.position = 'relative';
  }
  _context = CanvasElement().getContext('2d');
  _axesContext = CanvasElement().getContext('2d');
  _seriesContext = CanvasElement().getContext('2d');

  container.append(_context.canvas);
}