Skip to content

updating options does not override scales.yAxes[0].ticks.callback #105

@pRatikSathaye

Description

@pRatikSathaye

Hello,

I have embedded ember-cli-chart in my hbs file as

<div class="chart">
    {{ember-chart type='line' data=data options=options}}
</div>

In my component file I have created an options property as

options: computed('metric', function() {
  let opts = defaultOptions;
  if (this.metric === 'height') {
     opts.scales.yAxes = [{
         ticks: {
             callback: function(value, index, values) {
              // code to return labels
             }
        }
     }]
  } else {
     opts.scales.yAxes = [{
         ticks: {
             callback: function(item, index, items) {
                 // code to return labels
             }
        }
     }]
     return opts;
  }
});

So when first time chart loads it renders correct labels and if I change the metric then the same callback is getting used and renders same labels but with updated data values.
Can anyone help on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions