Charts

The Charts dashlet displays predefined bar graphs in the Charts UI (Reports  Charts) and the operator board. You can also create custom charts in charts-configuration.xml.

Charts dashlet configuration options
Field Description

Boost support

Not available

Properties: Chart

The existing chart’s type.

Properties: Maximize width

Rescale the image to fill display width.

Properties: Maximize height

Rescale the image to fill display height.

Create a custom chart

Follow these steps to create a custom chart:

  1. Find and copy a similar existing chart in charts-configuration.xml.

  2. Modify the name, domain-axis-label, and title values to match the new information that the chart will present.

  3. For each series-def value, update the following values:

    • Change the series name and domain-axis label as appropriate.

    • Modify the SQL to return a row with two columns—​the first column is the label, the second the numeric value. In most cases, the first column will be a string in single quotes, the second will be a count(*).

  4. Restart Horizon.

Example: Custom chart definition
  <tns:bar-chart name="Physical interfaces by type"
        variation="2d"
        domain-axis-label="Ethernet/PPP/Frame Relay"
        show-legend="true"
        plot-orientation="vertical"
        draw-bar-outline="true"
        range-axis-label="Count"
        show-urls="false"
    show-tool-tips="false">

    <tns:title font="SansSerif" style="" value="Physical Interface Inventory" pitch="12" />
    <tns:image-size>
      <tns:hz-size>
        <tns:pixels>450</tns:pixels>
      </tns:hz-size>
      <tns:vt-size>
        <tns:pixels>300</tns:pixels>
      </tns:vt-size>
    </tns:image-size>
    <tns:grid-lines visible="true">
        <tns:rgb>
            <tns:red>
                <tns:rgb-color>255</tns:rgb-color>
            </tns:red>
            <tns:green>
                <tns:rgb-color>255</tns:rgb-color>
            </tns:green>
            <tns:blue>
                <tns:rgb-color>255</tns:rgb-color>
            </tns:blue>
        </tns:rgb>
    </tns:grid-lines>
    <tns:series-def number="1" series-name="Ethernet" use-labels="true" >
          <tns:jdbc-data-set db-name="opennms" sql="select 'Eth', count(*) as Count from snmpinterface where snmpiftype=6;" />
      <tns:rgb>
        <tns:red>
          <tns:rgb-color>255</tns:rgb-color>
        </tns:red>
        <tns:green>
          <tns:rgb-color>0</tns:rgb-color>
        </tns:green>
        <tns:blue>
          <tns:rgb-color>0</tns:rgb-color>
        </tns:blue>
      </tns:rgb>
    </tns:series-def>
    <tns:series-def number="2" series-name="PPP" use-labels="true" >
          <tns:jdbc-data-set db-name="opennms" sql="select 'PPP', count(*) as Count from snmpinterface where snmpiftype=23;" />
      <tns:rgb>
        <tns:red>
          <tns:rgb-color>0</tns:rgb-color>
        </tns:red>
        <tns:green>
          <tns:rgb-color>255</tns:rgb-color>
        </tns:green>
        <tns:blue>
          <tns:rgb-color>0</tns:rgb-color>
        </tns:blue>
      </tns:rgb>
    </tns:series-def>
    <tns:series-def number="3" series-name="Frame Relay" use-labels="true" >
          <tns:jdbc-data-set db-name="opennms" sql="select 'FR', count(*) as Count from snmpinterface where snmpiftype=32;" />
      <tns:rgb>
        <tns:red>
          <tns:rgb-color>0</tns:rgb-color>
        </tns:red>
        <tns:green>
          <tns:rgb-color>0</tns:rgb-color>
        </tns:green>
        <tns:blue>
          <tns:rgb-color>255</tns:rgb-color>
        </tns:blue>
      </tns:rgb>
    </tns:series-def>
  </tns:bar-chart>
</pre>