Vue 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
JavaScript
$(function() {
    $("#sankeyContainer").dxSankey({
        dataSource: new DevExpress.data.DataSource({
            store: {
                type: "odata",
                url: "http://www.example.com/dataservices/odata/targetData",
                key: ["from", "to"]
            },
            paginate: false
        }),
        sourceField: "from",
        targetField: "to",
        weightField: "amount"
    });
});
Angular
TypeScript
HTML
import { DxSankeyModule } from "devextreme-angular";
import "devextreme/data/odata/store";
import DataSource from "devextreme/data/data_source";
// ...
export class AppComponent {
    sankeyDataSource: DataSource = new DataSource({
        store: {
            type: "odata",
            url: "http://www.example.com/dataservices/odata/targetData",
            key: ["from", "to"]
        },
        paginate: false
    });
}
@NgModule({
    imports: [
        // ...
        DxSankeyModule
    ],
    // ...
})
<dx-sankey
    [dataSource]="sankeyDataSource"
    sourceField="from"
    targetField="to"
    weightField="amount">
</dx-sankey>

The DataSource can also be used for data processing. In the following example, it is used to filter data:

jQuery
JavaScript
$(function() {
    $("#sankeyContainer").dxSankey({
        dataSource: new DevExpress.data.DataSource({
            store: {
                type: "odata",
                url: "http://www.example.com/dataservices/odata/targetData",
                key: ["from", "to"]
            },
            paginate: false,
            filter: [
                [ "amount", ">=", 6 ],
                [ "amount", "<=", 8 ]
            ]
        }),
        sourceField: "from",
        targetField: "to",
        weightField: "amount"
    });
});
Angular
TypeScript
HTML
import { DxSankeyModule } from "devextreme-angular";
import "devextreme/data/odata/store";
import DataSource from "devextreme/data/data_source";
// ...
export class AppComponent {
    sankeyDataSource: DataSource = new DataSource({
        store: {
            type: "odata",
            url: "http://www.example.com/dataservices/odata/targetData",
            key: ["from", "to"]
        },
        paginate: false,
        filter: [
            [ "amount", ">=", 6 ],
            [ "amount", "<=", 8 ]
        ]
    });
}
@NgModule({
    imports: [
        // ...
        DxSankeyModule
    ],
    // ...
})
<dx-sankey
    [dataSource]="sankeyDataSource"
    sourceField="from"
    targetField="to"
    weightField="amount">
</dx-sankey>
See Also