DevExtreme React - Adaptive Layout
With the ever-growing variety of platforms, today's web sites and applications cannot stay competitive without being adaptive. Supporting this modern standard, the PieChart widget possesses an adaptive layout. This enables the PieChart to hide its accessory elements if the container is not large enough to fit them. 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
$(function() { $("#pieChartContainer").dxPieChart({ // ... adaptiveLayout: { height: 300, width: 400 } }); });
Angular
<dx-pie-chart ... > <dxo-adaptive-layout [height]="300" [width]="400"></dxo-adaptive-layout> </dx-pie-chart>
import { DxPieChartModule } from "devextreme-angular"; // ... export class AppComponent { // ... } @NgModule({ imports: [ // ... DxPieChartModule ], // ... })
The layout does not automatically adapt to changes made in the widget's container at runtime. Therefore, if you enable a user to resize the container, call the render() method after each resizing to render the PieChart in the new size.
jQuery
$("#pieChartContainer").dxPieChart("render");
Angular
import { ..., ViewChild } from "@angular/core"; import { DxPieChartModule, DxPieChartComponent } from "devextreme-angular"; // ... export class AppComponent { @ViewChild(DxPieChartComponent, { static: false }) pieChart: DxPieChartComponent; // Prior to Angular 8 // @ViewChild(DxPieChartComponent) pieChart: DxPieChartComponent; renderPieChart () { this.pieChart.instance.render(); }; } @NgModule({ imports: [ // ... DxPieChartModule ], // ... })
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.