Git Product home page Git Product logo

devexpress-examples / asp-net-web-forms-dashboard-custom-properties-sample Goto Github PK

View Code? Open in Web Editor NEW
2.0 56.0 0.0 2.45 MB

The example shows how to create custom properties for the ASP.NET Web Forms Dashboard.

License: Other

JavaScript 63.94% C# 15.84% ASP.NET 3.29% Visual Basic .NET 16.93%
custom-properties asp-net-web-forms web-dashboard dashboard-for-web-forms business-intelligence

asp-net-web-forms-dashboard-custom-properties-sample's Introduction

Dashboard for Web Forms - Custom Properties

The example shows how to create custom properties for the Web Dashboard.

Files to Look At

Overview

Custom properties are stored in the CustomProperties collection in a structured format. Each custom property in this collection contains the custom property's metadata.

To apply custom property values to a dashboard, you need to create an extension. The extension is a JavaScript module that you can integrate into your application. Every extension that provides custom property can be divided into the following parts:

  1. Model

    The model is an object that contains the property name, type, and default value. It also specifies on which level the property is created (dashboard, dashboard item or data item container). Use the Model.registerCustomProperty property to register the custom property definition.

  2. Viewer

    In this part you modify the viewer part according to the saved custom property value. You can use the client methods and events to change the displayed elements.

  3. Designer

    This part contains designer settings. Add editors and control elements to configure and change the custom property's values in the UI. This part is not required if you use the extension in Viewer mode.

  4. Event Subscription

    This part contains event subscriptions.

Registration

To register an extension, attach the extension script before the control is rendered and call the registerExtension method:

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        function onBeforeRender(sender) {
            var control = sender.GetDashboardControl();
            control.registerExtension(new DevExpress.Dashboard.DashboardPanelExtension(control));

            control.registerExtension(new ChartScaleBreaksExtension(control));
            control.registerExtension(new ChartLineOptionsExtension(control));
            control.registerExtension(new ChartAxisMaxValueExtension(control));
            control.registerExtension(new ChartConstantLinesExtension(control));
            control.registerExtension(new ItemDescriptionExtension(control));
            control.registerExtension(new DashboardDescriptionExtension(control));
            control.registerExtension(new GridHeaderFilterExtension(control));
        }
    </script>

    <dx:ASPxDashboard ID="ASPxDashboard1" runat="server" Width="100%" Height="100%" WorkingMode="Viewer" UseNeutralFilterMode="true">
        <ClientSideEvents BeforeRender="onBeforeRender" />
    </dx:ASPxDashboard>

    <script src="Content/Extensions/ChartAxisMaxValueExtension.js"></script>
    <script src="Content/Extensions/ChartConstantLinesExtension.js"></script>
    <script src="Content/Extensions/ChartLineOptionsExtension.js"></script>
    <script src="Content/Extensions/ChartScaleBreaksExtension.js"></script>
    <script src="Content/Extensions/ItemDescriptionExtension.js"></script>
    <script src="Content/Extensions/DashboardDescriptionExtension.js"></script>
    <script src="Content/Extensions/GridHeaderFilterExtension.js"></script>
</asp:Content>

Example structure

The following example contains a set of custom properties that demonstrate different capabilities. Below you find a detailed description for every extension.

ChartScaleBreaksExtension

View Extension

This extension enables or disables scale breaks for the Chart dashboard item.

Overview:

  • Adds a custom Boolean property for a specific dashboard item (Chart).
  • Integrates a Scale breaks (Custom) section into the Options menu with the dxCheckBox widget as an editor.

ChartLineOptionsExtension

View Extension

This extension changes the dash style of each series line in the Chart dashboard item.

Overview:

  • Adds a string custom property for a specific data item container (Chart's series).
  • Integrates a Line Options (Custom) section into the data item menu with the dxSelectBox widget as an editor.

DashboardDescriptionExtension

View Extension

This extension enables you to set a dashboard's description in the dashboard menu. The dashboard description is displayed when you hover over the info button in the dashboard title.

Overview:

  • Adds a custom string property for a dashboard.
  • Shows how to add a new item to the ToolBox. In this example, a new item is added to the dashboard menu.
  • Demonstrates how to create complex editors using templates. In this example, it is the dxPopup widgets with the dxTextArea and dxButton widgets inside.

ItemDescriptionExtension

View Extension

This extension enables you to set a description for each dashboard item. The dashboard item description is displayed when you hover over the info button in the item's caption.

Overview:

  • Adds a custom string property for each dashboard item.
  • Integrates a Description (Custom) section into the Options menu with the predefined buttonGroup template.
  • Shows how to enable or disable editors depending on a custom property's value.

ChartAxisMaxValueExtension

View Extension

This extension allows you to change the maximum value of the Y-axis in the Chart item.

Overview:

  • Adds a set of custom properties with different types (number, boolean, and string) for a specific dashboard item (Chart).
  • Demonstrates how to bind a custom property to a list of data items.
  • Shows how to enable or disable editors depending on a custom property's value.

ChartConstantLinesExtension

View Extension

This extension draws constant lines for the Chart dashboard item.

Overview:

  • Adds a complex custom property for a specific dashboard item (Chart).
  • Shows how to work with complex custom values that are saved as an array.
  • Demonstrates how to bind a custom property to a list of data items.
  • Customizes export to display the result in the exported document.

GridHeaderFilterExtension

View Extension

This extension adds Header Filter buttons to the Grid dashboard item.

Overview:

  • Adds a custom property for a specific dashboard item (Grid).
  • Integrates a Header Filter (Custom) section, which contains the ButtonGroup widget as an editor, into the Options menu.

Documentation

More Examples

asp-net-web-forms-dashboard-custom-properties-sample's People

Contributors

alexanderkovalenko avatar natakazakova avatar sergeynakhankov avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.