grofit / aurelia-chart

A chart element for aurelia which is powered by chart js using html5 canvas.
MIT License
46 stars 25 forks source link

Two-way binding on native options #22

Closed rmja closed 7 years ago

rmja commented 7 years ago

To allow accessing and overwriting native options after the chart is attached, it would be nice if the nativeOptions was default two-way bound (@bindable({defaultBindingMode: bindingMode.twoWay})), and in createChart() the active chart options was written back to the nativeOptions property:

createChart() {
    this._chartData = {
      type: this.type,
      data: this._clonedData,
      options: this._clonedNativeOptions
    };

    this._activeChart = new Chart(this.canvasElement, this._chartData);
    this.refreshChart();

    this.nativeOptions = this._activeChart.options;
  };
grofit commented 7 years ago

If you know how you want it to work by all means raise a PR for it, I am happy for any PRs as long as new features do not break normal use-cases.