0
votes

I have a grid and a line chart. Both of them use one store. I use grid column renderer() function which looks like this:

renderer: function(value){
   return value;
} 

to change the data depending on some conditions(delta, ratios etc). I also want to reflect these actions in my chart. I guess I should set series renderer() but it doesn't have value as parameter:

renderer: function (sprite, config, rendererData, index) {
 if (config.type === 'marker') {
     return { strokeStyle: (index % 2 === 0 ? 'red' : 'black') };
 }
} 

Is it possible to implement rendering such as in grid to change my plot but without changing actual data in store?

1

1 Answers

0
votes

If I am not mistaken, the value you are searching can be found in the rendererData parameter, which is an object that contains the property angleField. I don't know whether changing it there affects the chart, but I would guess so (just like the metaData parameter in the grid renderer affects the rendering of the grid).

BUT:

Renderers only change the display of certain data. The underlying values stay the same, which may affect all kinds of data manipulation, like grouping, sorting etc.

If you really want to change the values based on conditions, you are better off if you extend the model, adding calculated columns, which do not persist, and set the dataIndexes of your gridcolumns accordingly (likewise for the chart).

I am not sure whether renderers can affect the size of the slices in a pie chart; but I am sure that if you (for example) sort the store by the slice size, changing the value in the renderer will not affect how the slices are ordered in the chart.

That said, it's up to you; my remark is for sake of completeness only.