forio / contour

Apache License 2.0
120 stars 21 forks source link

Update options reference when updating axis scales #271

Closed jaimedp closed 6 years ago

jaimedp commented 6 years ago

Fixes #269

narenranjit commented 6 years ago

Haven't actually tried this (if only there was a dist I could easily pull ;) ), but not sure this is addressing the same issue as in #269. That issue is for the following case:

var c = new Contour({
   xAxis: { max: ()=>  Math.floor(Math.random() * 5) + 5} 
});
c.render();

I'd expect the max to change each time the chart is re-rendered. Does this PR address that?

jaimedp commented 6 years ago

Hi, I'll test that case tonight, but I think is covered. The problem is was the the updated materialized options were not being passed to the scale generator after the first render, so line 229 (his.xScaleGenerator.update(this.xDomain, this.dataSrc, this.options);) should take care of that... I'll test that case anyway

jaimedp commented 6 years ago

I tested the case that you refer to and it works as expected. Re-rendering the chart changes the max value for the xAxis