Vue Funnel - OData Service
To bind the Funnel to data provided by an OData service, use the ODataStore.
jQuery
index.js
$(function() { $("#funnelContainer").dxFunnel({ dataSource: new DevExpress.data.DataSource({ store: { type: 'odata', url: 'https://www.example.com/dataservices/odata/targetData', key: 'Id' }, paginate: false }), // ... }); });
Angular
app.component.html
app.component.ts
app.module.ts
<dx-funnel [dataSource]="funnelDataSource"> <!-- ... --> </dx-funnel>
import { Component } from '@angular/core'; import 'devextreme/data/odata/store'; import DataSource from 'devextreme/data/data_source'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { funnelDataSource = new DataSource({ store: { type: 'odata', url: 'https://www.example.com/dataservices/odata/targetData', key: 'Id' }, paginate: false }); }
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; import { DxFunnelModule } from 'devextreme-angular'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, DxFunnelModule ], providers: [ ], bootstrap: [AppComponent] }) export class AppModule { }
Vue
App.vue
<template> <DxFunnel :data-source="funnelDataSource"> <!-- ... --> </DxFunnel> </template> <script> import DxFunnel from 'devextreme-vue/funnel'; import 'devextreme/data/odata/store'; import DataSource from 'devextreme/data/data_source'; const funnelDataSource = new DataSource({ store: { type: 'odata', url: 'https://www.example.com/dataservices/odata/targetData', key: 'Id' }, paginate: false }); export default { components: { DxFunnel }, data() { return { funnelDataSource } } } </script>
React
App.js
import Funnel from 'devextreme-react/funnel'; import 'devextreme/data/odata/store'; import DataSource from 'devextreme/data/data_source'; const funnelDataSource = new DataSource({ store: { type: 'odata', url: 'https://www.example.com/dataservices/odata/targetData', key: 'Id' }, paginate: false }); export default function App() { return ( <Funnel dataSource={funnelDataSource}> {/* ... */} </Funnel> ); }
As you may notice, in the previous code, the ODataStore is not declared explicilty. Instead, it is wrapped in the DataSource instance. That is because the Funnel requires pagination to be off in order to prevent data from partitioning. Other than that, the DataSource provides wide data-processing capabilities. For example, it can filter data.
jQuery
index.js
$(function() { $("#funnelContainer").dxFunnel({ dataSource: new DevExpress.data.DataSource({ store: { type: 'odata', url: 'https://www.example.com/dataservices/odata/targetData', key: 'Id' }, paginate: false, // Take summer months only filter: [ ['Id', '>=', 6], ['Id', '<=', 8] ] }), // ... }); });
Angular
app.component.html
app.component.ts
app.module.ts
<dx-funnel [dataSource]="funnelDataSource"> <!-- ... --> </dx-funnel>
import { Component } from '@angular/core'; import 'devextreme/data/odata/store'; import DataSource from 'devextreme/data/data_source'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { funnelDataSource = new DataSource({ store: { type: 'odata', url: 'https://www.example.com/dataservices/odata/targetData', key: 'Id' }, paginate: false, // Take summer months only filter: [ ['Id', '>=', 6], ['Id', '<=', 8] ] }); }
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; import { DxFunnelModule } from 'devextreme-angular'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, DxFunnelModule ], providers: [ ], bootstrap: [AppComponent] }) export class AppModule { }
Vue
App.vue
<template> <DxFunnel :data-source="funnelDataSource"> <!-- ... --> </DxFunnel> </template> <script> import DxFunnel from 'devextreme-vue/funnel'; import 'devextreme/data/odata/store'; import DataSource from 'devextreme/data/data_source'; const funnelDataSource = new DataSource({ store: { type: 'odata', url: 'https://www.example.com/dataservices/odata/targetData', key: 'Id' }, paginate: false, // Take summer months only filter: [ ['Id', '>=', 6], ['Id', '<=', 8] ] }); export default { components: { DxFunnel }, data() { return { funnelDataSource } } } </script>
React
App.js
import Funnel from 'devextreme-react/funnel'; import 'devextreme/data/odata/store'; import DataSource from 'devextreme/data/data_source'; const funnelDataSource = new DataSource({ store: { type: 'odata', url: 'https://www.example.com/dataservices/odata/targetData', key: 'Id' }, paginate: false, // Take summer months only filter: [ ['Id', '>=', 6], ['Id', '<=', 8] ] }); export default function App() { return ( <Funnel dataSource={funnelDataSource}> {/* ... */} </Funnel> ); }
See Also
Feel free to share topic-related thoughts here.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Thank you for the feedback!
If you have technical questions, please create a support ticket in the DevExpress Support Center.