Chart / Commanding / Command Bars / Chart Command Bars Overview
In This Topic
    Chart Command Bars Overview
    In This Topic

    NOV Chart provides a lot of commands and settings most of which can be shown to the end user in a command bars interface (menu and toolbars). There are two ways to create command bars associated with a chart view:

     Chart View with Command Bars Control

    If you are not creating a cross-platform application, the easiest way to create a chart view with command bars is to use the Visual Studio designer and drop an NChartViewWithCommandBarsControl from the Visual Studio toolbox to your form/window.

    Alternatively, you can use the NChartViewWithCommandBars class to add a chart view with command bars to your form/window programmatically. The example below demonstrates how to create a chart view with command bars hosted in a NOV widget host. You can then add this host to a form's Controls collection if you are creating a WinForms application, set it as the Content of a WPF window in a WPF application project, or to the ContentView of a Xamarin.Mac window.

    Create a chart view with command bars
    Copy Code
    NChartViewWithCommandBars chartViewWithCommandBars = new NChartViewWithCommandBars(); // Create a chart view with command bars
    NChartView chartViewWithCommandBars = ribbonUI.View; // Get the chart view
    
    // Create a NOV widget host that hosts the chart view with command bars
    NNovWidgetHost<NWidget> novHost = new NNovWidgetHost<NWidget>(chartViewWithCommandBars);
    
     Chart Command Bar Builder

    NOV Chart provides a command bar builder that can be used to create toolbars to control and edit the chart view and its charts. This builder is represented by the class NChartCommandBarBuilder.

    The following code fragment demonstrates how to create a command bar-based commanding UI using a chart command bar builder and associate it with a chart view:

    Create Command Bars UI
    Copy Code
    NDiagramCommandBarBuilder commandBarBuilder = new NDiagramCommandBarBuilder();
    NWidget uiWidget = commandBarBuilder.CreateUI(drawingView);
    
    See Also