Note that there are some explanatory texts on larger screens.

plurals
  1. POExtJS: share store between grid and chart
    text
    copied!<p>I'm writing a simple application storing and displaying timestamped messages. Messages are JSON objects containing, say 2 main fields like:</p> <pre><code>{ "emitted": "2011-12-08 12:00:00", "message": "This is message #666" } </code></pre> <p>I have a model to describe these messages:</p> <pre><code>Ext.define('Message', { extend: 'Ext.data.Model', fields: [ { name: 'emitted', type: 'date' }, { name: 'message', type: 'string' } ] }); </code></pre> <p>I have no problem displaying these messages in a grid. However, i would now like to display these messages in a chart. For instance, I would be able to grab numbers (like the #666 in the above example) and display a line chart.</p> <p>Ideally, i don't want to create a new store for the chart, i would like to reuse the same message store, but apply a filter on the fields to grab the proper value. I don't know, something that might look like:</p> <pre><code>var chart = { xtype: 'chart', ... series: [{ type: 'line', axis: ['left', 'bottom'], xField: 'emitted', yField: {fieldName:'message', fieldGrabber: function(v) { new RegExp("This is message #(\d+)$", "g").exec(v)[1] }} }] }; </code></pre> <p>Does this kind of thing is possible in ExtJS ? I just tried to explain what I'm trying to do, i have no idea where to find such a feature: in the chart class, in the store class, or using a kind pf proxy to the store.</p> <p>Side note: I cannot ask the data to be properly formatted to the server. The messages I receive are not backed up anywhere, they are just live events streamed to the client via socketIO.</p> <p>Any advices greatly appreciated!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload