import Heatmap from "heatmap.js";

export default class LineHeatmap {

  constructor (elementID) {
    this.ID = elementID;
    this.heatmap = null;
  }

  get instance () {
    return this.heatmap;
  }

  create (config = {}) {
    let myConfig = {
      container: document.getElementById(this.ID)
    }
    myConfig = Object.assign(myConfig, config);
    this.heatmap = Heatmap.create(myConfig);
    console.log(this.heatmap);
  }

  setTrackData (data) {
    this.heatmap.setData({
      max: 0,
      min: 0,
      data: []
    });
    data.forEach(point => {
      this.heatmap.addData(point);
    });
  }
}
