Chart¶
The Chart dashboard panel is used for displaying a graphical chart from any data source. Chart types include:
-
Area
-
Areaspline
-
Bar
-
Column
-
Line
-
Pie
-
Spline
Data sources can come from database queries or AJAX calls.
Form Fields¶
-
Panel Name - Name of the panel to be displayed in the panel header.
-
Title - The title of the chart, centered at the top.
-
Subtitle - The subtitle of the chart, center at the top below the title.
-
Chart Type - The type of chart from the available list of line, spline, area, areaspline, bar, column, pie.
-
X-Axis Type - The type of the x-axis can be category for most cases or timeseries when the category is in epoch time.
-
Stacking - Whether to show additional series of data stacked on top of the previous series.
-
Legend - Whether to show the legend at the bottom of the chart or not.
-
Extra Config - Extra HighCharts configuration that will be merged into the final configuration. Refer to the HighCharts documentation for additional details.
-
Source - The source of the data for the chart can be Database for an Assure1 database query, or AJAX for a local script that processes it's own data and returns JSON.
-
Database Query - The existing database query saved in the system.
-
AJAX URL - The absolute URL path to the script that returns JSON data on the local server.
-
Category Field - The field in the JSON response that defines the category on the x-axis.
-
Value Field - The field in the JSON response that defines the value on the y-axis.
-
Series Field - The field in the JSON response that uniquely identifies the series for the category and value. Only one series can be defined for pie charts.
-
Meta Field - The field in the JSON response that allows additional data to be added to the series or point.
-
Hide Header - Whether or not the panel header should be shown.
-
Width - Limit the panel to a specific percent width of the dashboard, ranging from 0.01 to 1.
-
Height - If Auto Height is not checked, limit the panel to a specific height in pixels.
-
Refresh Rate - The default chart refresh rate in seconds.
Examples¶
Example 1¶
Create a query to return real-time event data for a line, area, bar, or column chart.
Steps¶
-
Go to the Queries UI: Configuration -> Databases -> Queries
-
Click on the Add button, then set the following:
-
Query Name => Real-time Event Counts by Severity
-
Schema => Event
-
ShardID => 1
-
Query User Owner => [Public to All Users In Group]
-
Query Group Owner => [Public to All Groups]
-
Query =>
SELECT ELT(Severity + 1, 'Normal', 'Unknown', 'Info', 'Minor', 'Major', 'Critical') AS Severity, ELT(Severity + 1, '{"color":"\#66E066"}', '{"color":"\#D088F4"}', '{"color":"\#A1D3FE"}', '{"color":"\#FEFE66"}', '{"color":"\#FED07E"}', '{"color":"\#FE6666"}') AS Meta, DAYNAME(FROM_UNIXTIME(FirstReported)) AS Day, SUM(Count) AS Count FROM Events GROUP BY Severity, DAYNAME(FROM_UNIXTIME(FirstReported)) ORDER BY Severity, DAYOFWEEK(FROM_UNIXTIME(FirstReported))
-
Click "Submit" to save the query.
-
-
Go to the Dashboards UI: Configuration -> Dashboards -> Dashboards
-
Click on the Add button, then set the following:
-
Dashboard Name => Real-time Event Counts by Severity
-
Query User Owner => [Public to All Users In Group]
-
Query Group Owner => [Public to All Groups]
-
In the New Dashboard area, click in the Click here to add panel box, then select "Add Panel -> Chart", then click on the Configure Panel button. Set the following:
-
Panel Name => Events
-
Database Query => Real-time Event Counts by Severity
-
Category Field => Day
-
Value Field => Count
-
Series Field => Severity
-
Meta Field => Meta
-
Click the View button to save the panel settings.
-
-
Click Submit button to save the dashboard.
-
Example 2¶
Create a query to return real-time event data for a pie chart.
Steps¶
-
Go to the Queries UI: Configuration -> Databases -> Queries
-
Click on the Add button, then set the following:
-
Query Name => Real-time Event Counts for Pie
-
Schema => Event
-
ShardID => 1
-
Query User Owner => [Public to All Users In Group]
-
Query Group Owner => [Public to All Groups]
-
Query =>
SELECT DAYNAME(FROM_UNIXTIME(Reported)) AS Day, 'Alarm Count' AS Name, SUM(Count) AS Count FROM Events
-
Click "Submit" to save the query.
-
-
Go to the Dashboards UI: Configuration -> Dashboards -> Dashboards
-
Click on the Add button, then set the following:
-
Dashboard Name => Real-time Event Counts for Pie
-
Query User Owner => [Public to All Users In Group]
-
Query Group Owner => [Public to All Groups]
-
In the New Dashboard area, click in the Click here to add panel box, then select "Add Panel -> Chart", then click on the Configure Panel button. Set the following:
-
Panel Name => Events
-
Chart Type => Pie
-
Database Query => Real-time Event Counts for Pie
-
Category Field => Day
-
Value Field => Count
-
Series Field => Name
-
Click the View button to save the panel settings.
-
-
Click Submit button to save the dashboard.
-