The following example shows how to save custom settings to a dashboard XML definition in the Dashboard Designer and apply these settings in the Dashboard Viewer.
This example contains four projects - the Dashboard Designer and three types of the Dashboard Viewer: WinForms, Web and MVC. In the Designer, you can change the font size of chart legend items. The IUnderlyingControlProvider interface is used to access the underlying Chart control in the Dashboard Designer and change the font size of legend items. The Dashboard.UserData property provides the capability to save this value to the dashboard XML definition. Finally, dashboard definitions included in Dashboard Viewer projects are updated using the Dashboard.SaveToXml method.
In Dashboard Viewer projects, special members are used to access underlying controls and apply the custom font size:
- In the WinForms DashboardViewer, the DashboardItemControlUpdated event is used to access the underlying chart control.
- In the Web/MVC Viewer, the ItemWidgetCreated event is used to access the underlying dxChart widget. The CustomJSProperties event is handled to send custom data from the server to the client.
Note that changing specific control/widget settings may lead to various issues. To learn more, see the following topics:
- Access to Underlying Controls
- Access to Underlying Widgets