简体   繁体   English

ExtJS 5图表系列渲染器

[英]ExtJS 5 chart series renderer

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()函数:

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(),但是它没有值作为参数:

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 ? 是否可以在网格中实施渲染以更改图但不更改商店中的实际数据

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 . 如果我没记错的话,可以在rendererData参数中找到您要搜索的value ,该参数是一个对象,其中包含属性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). 我不知道在此更改是否会影响图表,但我会这样猜测(就像网格渲染器中的metaData参数会影响网格的渲染一样)。

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 calculate d columns, which do not persist, and set the dataIndex es of your gridcolumn s accordingly (likewise for the chart). 如果你真的想改变基于条件的值,你,如果你扩展模型,将是最好calculate d列,这不会持续,并设置dataIndex您的ES gridcolumn因此S(同样图表)。

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. 我的发言仅出于完整性考虑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM