简体   繁体   中英

Multiple timeline series in ExtJS4 chart with one store

The data, that comes from the server looks like this:

[
  { date: 123456789, browser: 'firefox', clicks: 123, ... },
  { date: 123456789, browser: 'chrome' , clicks: 456, ... },
  { date: 123456790, browser: 'firefox', clicks: 678, ... },
  { date: 123456790, browser: 'chrome' , clicks: 453, ... },
  { date: 123456791, browser: 'firefox', clicks: 234, ... },
  { date: 123456791, browser: 'chrome' , clicks: 555, ... },
  ...
]

I generate my models from this, pack them into a store and show them in a grid, which works fine.

But now I want to show a timeline chart for this table, and it should have one series for every browser.

Is it possible to filter series?

Something like this:

series: [
  {
    type  : 'line', 
    title : 'Chrome',
    xfield: 'clicks',
    yfield: 'date',
    filter: { browser: '*chrome*' }
  }
]

You can only filter a store, but when you filter the store your grid will get filtered aswell. You could make a copy of the store, or create a new store with filtered data from the first store.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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