.. _automate-dashboards-chart-widgets:


Chart widgets
--------------

.. _25.1|EKB-17791:
.. _25.1|EKB-17881:
.. _25.2|VOSS-1523|EKB-24633:
.. _25.3|EKB-26403:
.. _25.4|VOSS-1490|EKB-26832:
.. _25.4|VOSS-1581|EKB-25720:

.. tip:: 

   :ref:`use-action-search-to-navigate-automate`


Overview 
............

The dashboard widgets support the following chart types:

* Column Chart
* Gauge Chart
* Line Chart
* Pie Chart
* Chord Diagram Chart

When a chart widget is selected, it is also possible to switch to another widget format during
the edit and design process.

The chart type can be updated from the **Widget Type** drop down. Changes are reflected in real-time
during the design of a widget or by using the widget's **Refresh** icon.

.. image:: /src/images/dashboard-new-widget-type.png


Chart widget data settings
.............................

The list of data settings for chart widgets follow:

* **Title**

  The text to display above the chart.

* **Description**

  This text displays as an informational pop-up when hovering over the
  circled **i** icon adjacent to the title.

* **Condition**

  The display of the widget on the dashboard can be controlled by entering
  a condition that resolves to boolean True or False, for example in
  accordance with enabled features, services, and devices, as in the
  **Global Settings**. The conditions are in the form of system macros.
  See for example the macros listed under the *Links* topic below.

* **Data Source**

  Charts can access the **Automate Analyzed** and **Assurance** sources.
  The **Assurance** data source is also available if an Arbitrator is
  configured. See *Arbitrators*.

* **Data Source Instance**

  Displays if **Assurance** is selected as the data source as multiple
  instances can be configured. A selection of these can also be made if
  **Allow Data Source Selection** is enabled.

* **Resource**

  Depends on the selected data source, a drop-down list of resource items
  available to be referenced in the chart. For example, for
  **Automate Analyzed**: ``Number Inventory``, ``Cisco CUC User``,
  ``Cisco UCM Phone``, ``Microsoft O365 User``.

  .. note::

     * Where the data source is **Automate Analyzed**, Automate provides
       an additional list of **Resource** instances that can be used to
       represent trends on a widget. For details, see
       :ref:`automate-dashboard-trends-resources`
     * Based on the selected hierarchy when working with a dashboard,
       the real-time display of data updates according to the current
       hierarchy, so that a widget that for example shows a count of
       users, displays values relevant to the selected hierarchy.

  .. important::

     For charts, **Resource** data is accessed from an Automate Analyze
     database: reporter resources (``data/ReporterResource``). When
     creating charts for the first time, *prior to the first scheduled
     full sync*, it will be necessary that a manual sync of the Automate
     Analyze database is carried out with the Automate database. This
     requires the execution of a Platform Command Line Interface
     command. Refer to the *Dashboard Refresh* section below.

* **Fields**

  Depending on the selected **Resource**, one or more fields from the
  resource can be selected as items for the chart.

  * **Field Name**

    A drop-down of fields belonging to the **Resource**. For example,
    for **Chord Diagram Chart** (**Sankey** type in the example image
    below), the **Transactions** resource **status** and **username**
    field names can be selected to show the transaction success/fail
    breakdown by user:

    .. image:: /src/images/dashboard-chord-chart-sankey.png

  * **Friendly Name**

    A text field to provide the **Field Name** with a custom name.

  * **Field Type**

    A read-only field indicating the data type of the selected **Field
    Name**. For example, if the **Data Source** is **Arbitrator**, a
    **Resource** instance may show the **Field Type** as ``Calculated -
    Text``.

  * **Operation**

    Select the operation to be carried out on the **Field Name**. Refer
    to the example below showing: ``Grouping Count``.

    .. note::
    
       A different operation can be applied to the same field. In the
       example below, average, minimum, and maximum is applied to the
       transaction duration field:

    .. image:: /src/images/dashboard-1field-operation-avg-min-max.png

  * **Value Mapping**

    Default is ``NO MAPPING``, otherwise a selected value mapping to
    display the value on the chart widget. See
    :ref:`dashboard_value_mapping`

  * Minimum and maximum values

    Where values on a chart range across a minimum and maximum, this
    range will be used on the y-axis in order to improve the display of
    the chart, as seen in the example image below:

    .. image:: /src/images/dashb-chart-min-max-y-axis.png

* **Custom Fields**

  See: :ref:`automate-dashboards-widget-common-fields`

* **Filters**

  Data referenced in widgets can also be filtered by selecting:

  * **Field Name** of the **Resource**
  * **Operation**

    To be used to filter the values of the field selected by **Field
    Name**. The availability and function of the operators depends of
    the data type of the selected field name: text or integer. Select
    the required operation. For details on the filter options, see
    :ref:`filter-options-availability`

* **Filter Value**

  Value to be used by the selected **Operation** to carry out the
  filter. Such filters provide options to make use of a selection of
  the resource data in the widget.

* **Sorts**

  One or more **Field Name** entries can be added and used to carry out
  sorting by **Sort Type**: Ascending or Descending.

* **Chart Options**

  Available Chart Options can vary according to the selected chart
  widget type. For a detailed reference of chart options, see:
  :ref:`chart-options-availability`

* **Drill-down options**

  See :ref:`widget-drilldown-options-conditional-json`

* **Dashboard chart background colors**

  Managed by the theme **Panel Color**. See
  :ref:`reference-admin-gui-theme-customization-colors`


..  * **Contains** or **Does Not Contain** for sub-string matches
..  * **Starts With** or **Ends With** for string start or end matches
..  * **Equals** or **Not Equal** for exact matches


.. rubric:: Numeric precision

Chart widgets support a ``numericPrecision`` setting to control the number of decimal places in chart data 
labels and tooltips.

* Default: 0 (unless overridden)
* Maximum: 10 (values above 10 are capped)
* Behavior: Formats are applied per chart type (e.g., {y:,.Xf}, {point.weight:,.Xf}, or {point.sum:,.Xf}), 
  and are injected or replaced where {y} tokens are used.

.. note:: 

   Some link/node charts (e.g., Chord / Dependency wheel) may default to 2 decimals in specific series-mapping 
   contexts if **numericPrecision** isn't set. See :ref:`chart-options-availability` 
   for details per chart type.


Chart widget example
......................

As an example, consider the following column chart values, with charts illustrating 
various data and chart settings:

* Title: ``CUCM User Departments``
* Resource: ``Cisco UCM User``
* Field Name: ``Department``
* Operation: ``Grouping Count``

  Shows a column chart with counts of grouped ``Cisco UCM User`` departments in columns.
* Filter:

  * Field name: ``department``
  * Operation: ``Exclude Regex (Case sensitive)``
  * Filter Value: ``SITE``

* Filter:

  * Field name: ``department``
  * Operation: ``Exclude Regex (Case sensitive)``
  * Filter Value: ``LOC``
    
* Filter:

  * Field name: ``department``
  * Operation: ``!=``
  * Filter Value: 

* Sorts: 
  
  * Field Name: ``department``
  * Sort Type: ``Ascending``  

* Chart Options:

  * Series Limit: All
  * Stack Type: ``Normal``  

The examples below show the chart with settings on some of the properties 
as *not set* or *set*, in the example above:

* Unfiltered, unsorted (related settings above are *not set*):

  .. image:: /src/images/column-chart-grouping-count-dept.png

* Filtered, sorted, stacked (related settings above are *set*):

  .. image:: /src/images/column-chart-grouping-count-dept2.png


