Nevron .NET Vision
Chart for .NET / User's Guide / Panels / Numeric Display

In This Topic
    Numeric Display
    In This Topic
     Numeric Display Panel

    The numeric display panel is a special type of panel allowing you to display numeric values with an emulation of a LED display.

    Each display consists of cells, which in turn consist of one or more segments that are layout depending on the cell type. The number of segments in a cell cannot change, however the number of cells in a display can.

    The functionality of the numeric display panel is exposed through the properties and methods of the NNumericDisplayPanel class.

     Numeric Display Panel Styles

    The numeric display panel can display numeric data in several styles which are grouped by the type of the display cells:

    • 7 Segment Display Cell
    • 14 Segment Display Cell
    • 5x7 Segment Matrix Display Cell

    You change the display style by modifying the DisplayStyle property of the panel. For example:

    C#
    Copy Code
    NNumericDisplayPanel numericDisplay = new NNumericDisplayPanel();
    nChartControl1.Panels.Add(numericDisplay);
    
    numericDisplay.DisplayStyle = DisplayStyle.SevenSegmentRounded;
    numericDisplay.Value = 123456789.00;
    
    Visual Basic
    Copy Code
    Dim numericDisplay As NNumericDisplayPanel = New NNumericDisplayPanel
    NChartControl1.Panels.Add(numericDisplay)
    
    numericDisplay.DisplayStyle = DisplayStyle.SevenSegmentRounded
    numericDisplay.Value = 123456789.0
    

    The following table summarizes the appearance you can expect for each value from the DisplayStyle enumeration:

    Display Style Appearance
    SevenSegmentNormal
    SevenSegmentRectangular
    SevenSegmentRounded
    FourteenSegmentNormal
    FourteenSegmentRectangular
    FourteenSegmentInset
    MatrixRectangle
    MatrixCircle

     Decimal Formatting and Cell Size

    By default the numeric display panel will use a formatting that allows for double digit decimal precision and will automatically adjust the number of cells in the display so that it can display the specified number.

    The numeric display panel has a property called EnableDecimalFormatting that allows you to enable/disable decimal specific formatting. In the screen shots above decimal formatting is enabled (which is the default) and the cell size for the decimal digits is modified to be smaller than the cell size of the major digits (by default the cell size is 20pt x 40pt). The following code will replicate the configuration of the SevenSegmentNormal style display shown above:

    C#
    Copy Code
    NNumericDisplayPanel numericDisplay = new NNumericDisplayPanel();
    nChartControl1.Panels.Add(numericDisplay);
    
    numericDisplay.DisplayStyle = DisplayStyle.SevenSegmentNormal;
    numericDisplay.DecimalCellSize = new NSizeL(new NLength(15), new NLength(30));
    numericDisplay.Value = 123456789.00;
    
    Visual Basic
    Copy Code
    Dim numericDisplay As NNumericDisplayPanel = New NNumericDisplayPanel
    NChartControl1.Panels.Add(numericDisplay)
    
    numericDisplay.DisplayStyle = DisplayStyle.SevenSegmentNormal
    numericDisplay.DecimalCellSize = New NSizeL(New NLength(15), New NLength(30))
    numericDisplay.Value = 123456789.0
    

    When you set the EnableDecimalFormatting to false all cells will have common appearance and size.

     Cell Appearance

    In order to display a character (or other value) each cell can lit some of its segments. The lit and dim fill styles applied to a cell are controlled through a set of properties exposed by the numeric display panel. The following code will change the lit and dim fill styles of cells used to display the integral portion of the value:

    C#
    Copy Code
    NNumericDisplayPanel numericDisplay = new NNumericDisplayPanel();
    nChartControl1.Panels.Add(numericDisplay);
    
    numericDisplay.Value = 123456789.00;
    
    numericDisplay.LitFillStyle = new NColorFillStyle(Color.DarkRed);
    numericDisplay.DimFillStyle = new NColorFillStyle(Color.FromArgb(20, Color.DarkRed));
    
    Visual Basic
    Copy Code
    Dim numericDisplay As NNumericDisplayPanel = New NNumericDisplayPanel
    NChartControl1.Panels.Add(numericDisplay)
    
    numericDisplay.Value = 123456789.0
    
    numericDisplay.LitFillStyle = New NColorFillStyle(Color.DarkRed)
    numericDisplay.DimFillStyle = New NColorFillStyle(Color.FromArgb(20, Color.DarkRed))
    
     Cell Count

    The numeric display panel has a property called CellCountMode which allows you to configure whether the display will adjust the number of cells depending on the value being displayed or will contain a fixed number of cells.

    By default the value of this property is set to DisplayCellCountMode.Auto meaning that the display will automatically adjust the number of cells. In certain cases however you may wish that the display contains a fixed number of cells. The following code fixes the number of cells to 7:

    C#
    Copy Code
    NNumericDisplayPanel numericDisplay = new NNumericDisplayPanel();
    nChartControl1.Panels.Add(numericDisplay);
    
    numericDisplay.Value = 123456789.00;
    numericDisplay.CellCountMode = DisplayCellCountMode.Fixed;
    numericDisplay.CellCount = 7;
    
    Visual Basic
    Copy Code
    Dim numericDisplay As NNumericDisplayPanel = New NNumericDisplayPanel
    NChartControl1.Panels.Add(numericDisplay)
    
    numericDisplay.Value = 123456789.0
    numericDisplay.CellCountMode = DisplayCellCountMode.Fixed
    numericDisplay.CellCount = 7
    

    Note that in this case the digits 12345 will be clipped, because there are no enough cells in the display.

     Display Direction

    By default the display will show the value with right to left alignment. You can change that by using the DisplayDirection property. For example:

    C#
    Copy Code
    NNumericDisplayPanel numericDisplay = new NNumericDisplayPanel();
    nChartControl1.Panels.Add(numericDisplay);
    
    numericDisplay.Value = 123456789.00;
    numericDisplay.DisplayDirection = DisplayDirection.LeftToRight;
    numericDisplay.CellCountMode = DisplayCellCountMode.Fixed;
    numericDisplay.CellCount = 7;
    
    Visual Basic
    Copy Code
    Dim numericDisplay As NNumericDisplayPanel = New NNumericDisplayPanel
    NChartControl1.Panels.Add(numericDisplay)
    
    numericDisplay.Value = 123456789.0
    numericDisplay.DisplayDirection = DisplayDirection.LeftToRight
    numericDisplay.CellCountMode = DisplayCellCountMode.Fixed
    numericDisplay.CellCount = 7
    

    Note that in this case the 89.00 part of the value will be clipped.

     Cell Alignment

    When you use decimal formatting (e.g. when the decimal portion of the value is displayed with a different fill style and cell size) you can also take advantage of the CellAlignment property allowing you to control how cells are aligned relative to each other. By default this property is set to VertAlign.Bottom, meaning that the cells will be aligned at their bottom edge. You can choose between Top, Center and Bottom. The following code snippet shows how to align the cells on the top:

    C#
    Copy Code
    NNumericDisplayPanel numericDisplay = new NNumericDisplayPanel();
    nChartControl1.Panels.Add(numericDisplay);
    
    numericDisplay.Value = 123456789.00;
    numericDisplay.DecimalCellSize = new NSizeL(new NLength(15), new NLength(30));
    numericDisplay.ShowDecimalSeparator = false;
    numericDisplay.CellAlignment = Nevron.VertAlign.Top;
    
    Visual Basic
    Copy Code
    Dim numericDisplay As NNumericDisplayPanel = New NNumericDisplayPanel
    NChartControl1.Panels.Add(numericDisplay)
    
    numericDisplay.Value = 123456789.0
    numericDisplay.DecimalCellSize = New NSizeL(New NLength(15), New NLength(30))
    numericDisplay.ShowDecimalSeparator = False
    numericDisplay.CellAlignment = Nevron.VertAlign.Top
    

    For aesthetic reasons you may decide to hide the decimal separator when you change the cell alignment. The above code will result in the following image displayed by the panel:


     

     Sign Mode

    The sign mode property of the numeric display allows you to specify when it must show a leading sign (+ or -) depending on the displayed value. The following options are available:

    Sign Mode Description
    Never The numeric display will not show sign information.
    Always The numeric display will always show the sign in from of the numeric display.
    Negative The numeric display will only show a negative sign when the value is negative.

    This property also relates to the ShowLeadingZeros property. When the cell count mode is fixed you can optionally tell the display to fill the remaining cell positions with zero values. The following code shows how to configure a numeric display to display sign informaiton:

    C#
    Copy Code

    NNumericDisplayPanel numericDisplay = new NNumericDisplayPanel();

    numericDisplay.SignMode = SignMode.Always;
    numericDisplay.ShowLeadingZeros =
    true;
    numericDisplay.CellCountMode =
    DisplayCellCountMode.Fixed;
    numericDisplay.CellCount = 6;

    Visual Basic
    Copy Code

    Dim numericDisplay As New NNumericDisplayPanel

    numericDisplay.SignMode = SignMode.Always
    numericDisplay.ShowLeadingZeros =
    True
    numericDisplay.CellCountMode = DisplayCellCountMode.Fixed
    numericDisplay.CellCount = 6

     

     Related Examples
    Panels\Numeric Display\Numeric Led Display
    See Also