Exit Editor

Dashboard Business

The data visualization tools are widely used in all fields of industries. This example shows the specific business case to visualize the costs of the imaginary company across all the departments for the whole year combined in a single interactive dashboard.

Dashboard layout

The dashboard grid is created with 4 rows and 2 columns. Some visualization components in this example fill multiple cells by explicitly providing a row- & column- span during the creation.

  1. Top-left cell. The cell contains a chart that shows the costs per year for each department using Bar Chart or Column Chart implemented with SegmentSeries different tool than RectangleSeries. Segment series provides an ability to create and place freely line segments by specifying the start & end.

    // Create XY chart and attach to the dashboard.
    const barChart = dashboard.createChartXY({
        columnIndex: 2,
        rowIndex: 0,
        columnSpan: 2,
        rowSpan: 1
    })
    
    // Add segment series to series individual line segments.
    // This series uses default axes.
    const bars = barChart.addSegmentSeries()

    The segment series accepts input in the following format { startX: number, startY: number, endX: number, endY: number }. The series returns the created line segment to give an ability of further modifications. The chart fills 2 rows & 1 column.

    // Add line segment.
    const column = bars.add({
        startX: 10,
        startY: 10,
        endX: 20,
        endY: 20
    })

    Regarding the customization, each column can be configured to have individual styling and mouse & touch events. Each chart and series has mouse/touch events. Search in our API documentation by starting to type "onMouse".

    // Configure the created bar column.
    column
        .setStrokeStyle( style => ... )
        .onMouseEnter( () => pointerEnterHandler )
        .onTouchEvent( () => pointerEnterHandler )
  2. Top-right cell, upper part. This cell contains a UI panel that shows the total company costs for the whole year. UI panels are able to visualize only UI components. The chart fills 1 row & 1 column.

    // Create UI panel and attach to the dashboard.
    const panel = dashboard.createUIPanel({
        columnIndex: 3,
        rowIndex: 1,
        columnSpan: 1,
        rowSpan: 1
    })
    
    // Add UI element specifying the builder.
    // E.g. CheckBox, Button, Legend, etc.
    panel.addUIElement(/* builder from the library */)
    1. Top-right cell, lower part. This cell contains a chart which shows the only costs for a single department for each day of the year. The chart renders the line series with data gathered by moving the mouse over the column in the bar chart. The chart fills 1 row & 1 column.
    // Decide on an origin for DateTime axes.
    const dateTimeTickStrategy = AxisTickStrategies.DateTime(new Date(2018, 0, 1))
    
    // Create a chart for visualizing the costs of selected department.
    // Specify DateTime format for x-axis labels.
    const lineChart = dashboard.createChartXY({
        columnIndex: 2, 
        rowIndex: 1, 
        columnSpan: 1, 
        rowSpan:1, 
        chartXYOptions: { defaultAxisXTickStrategy: dateTimeTickStrategy }
    })
    
    // Create line series for elected department.
    const lineSeries = lineChart.addLineSeries()
  3. Bottom cell. This cell contains a chart which shows the smooth line ( using SplineSeries ) of total costs across all the apartments during the whole year. The chart fills 2 rows & 2 columns.

    // Create a chart for visualizing the total costs of the company.
    // Specify DateTime format for x-axis labels similarly as before.
    const totalCostsChart = dashboard.createChartXY({
        columnIndex: 0, 
        rowIndex: 0, 
        columnSpan: 2, 
        rowSpan:2, 
        chartXYOptions: { defaultAxisXTickStrategy: dateTimeTickStrategy }
    })
    
    // Create line series for total costs of the company.
    const lineSeries = lineChart.addSplineSeries()

© Arction Ltd 2009-2020. All rights reserved.