I've been using plaid-plot with time-scale, linear-scale and use #with pair-by.
When I update the data array with pushObject() the chart is moved to the left by (map-by 'x' data) but the plot is not updated leaving a gap where the new data should be drawn.
I examined the pair-by helper and saw there was no observer for the data array. I made some alterations as shown and got the chart to update properly.
addon/helpers/pair-by.js
import Ember from 'ember';
import Helper from 'ember-helper';
import observer from 'ember-metal/observer';
const { assert } = Ember;
export default Helper.extend({
compute(params) {
assert('pair-by requires at least 2 arguments: key, data', params.length >= 2);
let data = params.pop();
this.set('array', data);
assert('last argument must be an array of objects', Ember.isArray(data));
let [...keys] = params;
return data.map((d) => {
return keys.reduce((acc, k, index) => {
acc[index] = d[k];
return acc;
}, []);
});
},
contentDidChange: observer('array.[]', function() {
this.recompute();
})
});
Thanks for all your efforts.
Noel Sharrock
I've been using plaid-plot with time-scale, linear-scale and use #with pair-by.
When I update the data array with pushObject() the chart is moved to the left by (map-by 'x' data) but the plot is not updated leaving a gap where the new data should be drawn.
I examined the pair-by helper and saw there was no observer for the data array. I made some alterations as shown and got the chart to update properly.
addon/helpers/pair-by.js
Thanks for all your efforts.
Noel Sharrock