React Sankey - OData Service

To bind the Sankey to data from an OData service, use the ODataStore. You should declare it inside the DataSource configuration object because the Sankey UI component requires disabled pagination to prevent data from partitioning.

jQuery
index.js
$(function() {
    $("#sankeyContainer").dxSankey({
        dataSource: new DevExpress.data.DataSource({
            store: {
                type: 'odata',
                url: 'https://www.example.com/dataservices/odata/targetData',
                key: ['from', 'to']
            },
            paginate: false
        }),
        // ...
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-sankey [dataSource]="sankeyDataSource">
    <!-- ... -->
</dx-sankey>
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 {
    sankeyDataSource = new DataSource({
        store: {
            type: 'odata',
            url: 'https://www.example.com/dataservices/odata/targetData',
            key: ['from', 'to']
        },
        paginate: false
    });
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { DxSankeyModule } from 'devextreme-angular';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        DxSankeyModule
    ],
    providers: [ ],
    bootstrap: [AppComponent]
})
export class AppModule { }
Vue
App.vue
<template>
    <DxSankey :data-source="sankeyDataSource">
        <!-- ... -->
    </DxSankey>
</template>

<script>
import DxSankey from 'devextreme-vue/sankey';
import 'devextreme/data/odata/store';
import DataSource from 'devextreme/data/data_source';

const sankeyDataSource = new DataSource({
    store: {
        type: 'odata',
        url: 'https://www.example.com/dataservices/odata/targetData',
        key: ['from', 'to']
    },
    paginate: false
});

export default {
    components: {
        DxSankey
    },
    data() {
        return {
            sankeyDataSource
        }
    }
}
</script>
React
App.js
import Sankey from 'devextreme-react/sankey';
import 'devextreme/data/odata/store';
import DataSource from 'devextreme/data/data_source';

const sankeyDataSource = new DataSource({
    store: {
        type: 'odata',
        url: 'https://www.example.com/dataservices/odata/targetData',
        key: ['from', 'to']
    },
    paginate: false
});

export default function App() {
    return (
        <Sankey dataSource={sankeyDataSource}>
            {/* ... */}
        </Sankey>
    );
}

A 1-Click Solution for CRUD Web API Services with Role-based Access Control via EF Core

If you target .NET for your backend API, be sure to check out Web API Service and register your free copy today. The Solution Wizard scaffolds an OData v4 Web API Service (.NET 6+) with integrated authorization & CRUD operations powered by EF Core ORM. You can use OAuth2, JWT or custom authentication strategies alongside tools like Postman or Swagger (OpenAPI) for API testing. The built-in Web API Service also filters out secured server data based on permissions granted to users. Advanced/enterprise functions include audit trail, endpoints to download reports, file attachments, check validation, obtain localized captions, etc.

To use the free Solution Wizard (which creates the Web API Service), run the Universal Component Installer from the DevExpress Download Manager and use our predefined template in Visual Studio 2022+.

Read Tutorial | View Examples: JavaScript (DevExtreme) & JavaScript (Svelte) | Watch Videos

See Also