All docs
V20.2
24.1
23.2
23.1
22.2
22.1
21.2
21.1
20.2
20.1
19.2
The page you are viewing does not exist in version 19.2.
19.1
The page you are viewing does not exist in version 19.1.
18.2
The page you are viewing does not exist in version 18.2.
18.1
The page you are viewing does not exist in version 18.1.
17.2
The page you are viewing does not exist in version 17.2.
A newer version of this page is available. Switch to the current version.

jQuery Sankey - Adaptive Layout

The Sankey UI component has an adaptive layout that enables the UI component to hide optional elements if they do not fit in the container. To configure the adaptive layout, use the adaptiveLayout object. Set its height and width fields to specify the minimum container size at which the layout retains all its elements.

jQuery
JavaScript
$(function() {
    $("#sankeyContainer").dxSankey({
        // ...
        adaptiveLayout: {
            height: 300,
            width: 400
        }
    });
});
Angular
HTML
TypeScript
<dx-sankey ... >
    <dxo-adaptive-layout [height]="300" [width]="400"></dxo-adaptive-layout>
</dx-sankey>
import { DxSankeyModule } from "devextreme-angular";
// ...
export class AppComponent {
    // ...
}
@NgModule({
    imports: [
        // ...
        DxSankeyModule
    ],
    // ...
})
Vue
App.vue
<template> 
    <DxSankey ... >
        <DxAdaptiveLayout
            :height="300"
            :width="400"
        />
    </DxSankey>
</template>

<script>
import DxSankey, { DxAdaptiveLayout } from 'devextreme-vue/sankey';

export default {
    components: {
        DxSankey,
        DxAdaptiveLayout
    }
}
</script>
React
App.js
import React from 'react';
import Sankey, { AdaptiveLayout } from 'devextreme-react/sankey';

class App extends React.Component {
    render() {
        return (
            <Sankey ... >
                <AdaptiveLayout
                    height={300}
                    width={400}
                />
            </Sankey>
        )
    }
}

export default App;
NOTE

The layout does not automatically adapt if the UI component's container is resized at runtime. If you enable a user to resize the container, call the render() method each time it is resized to rerender the Sankey.

jQuery
JavaScript
$("#sankeyContainer").dxSankey("render");
Angular
TypeScript
import { ..., ViewChild } from "@angular/core";
import { DxSankeyModule, DxSankeyComponent } from "devextreme-angular";
// ...
export class AppComponent {
    @ViewChild(DxSankeyComponent, { static: false }) sankey: DxSankeyComponent;
    // Prior to Angular 8
    // @ViewChild(DxSankeyComponent) sankey: DxSankeyComponent;
    renderSankey() {
        this.sankey.instance.render();
    }
}
@NgModule({
    imports: [
        // ...
        DxSankeyModule
    ],
    // ...
})
Vue
App.vue
<template> 
    <DxSankey ref="sankey" />
</template>

<script>
import DxSankey from 'devextreme-vue/sankey';

export default {
    components: {
        DxSankey
    },
    methods: {
        renderSankey() {
            this.$refs.sankey.instance.render();
        }
    }
}
</script>
React
App.js
import React from 'react';
import Sankey from 'devextreme-react/sankey';

class App extends React.Component {
    constructor(props) {
        super(props);
        this.sankeyRef = React.createRef();
    }
    render() {
        return (
            <Sankey ref={this.sankeyRef} />
        )
    }
    get sankey() {
        return this.sankeyRef.current.instance;
    }
    renderSankey() {
        this.sankey.render();
    }
}

export default App;