
Line and area charts
Use line and area charts to track value trends over time. You can also use a line or area chart x-axis to represent a field value other than time.
Data formatting
Line charts can represent one or more data series. Area charts represent multiple data series.
If a search generates multiple series, each line or area in the chart appears in a different color.
To make sure that a search generates data series correctly, check the Statistics tab below in Search. The Statistics table should have at least two columns for a single series, and three or more columns for multiple series.
Statistics table order and chart axes
Line and area charts get x-axis values from the first column in the statistics table. The next table columns contain y-axis values.
As an example, any search using the timechart
reporting command generates a table where _time
is the first column. A line or area chart generated with this search has a _time
x-axis.
Search results not structured as a table with valid x-axis or y-axis values cannot generate line or area charts. For example, using the eval
or fields
commands might change search result structure.
Generate a line or area chart
- Select the line or area chart using the visual editor by clicking the Add Chart button (
) in the editing toolbar and either browsing through the available charts, or by using the search option.
- Select the chart on your dashboard so that it's highlighted with the blue editing outline.
- (Optional) Set up a new data source by adding a query to the Search window.
- To choose an existing search, close the window and select the visualization. If the Configuration panel doesn't appear, click the Configuration button (
) to bring up the Configuration panel and click +Setup Primary Data Source to choose an existing search.
Configuration Panel options for line and area charts
You can use the Configuration panel to configure the following line chart components.
Title
Give your visualization a name. This is also helpful when searching for individual visualizations in the dashboard definitions. This name is not the same as the automatically assigned unique ID.
Description
Give your visualization a description to explain what the user is viewing.
Data Configurations
Choose an existing ad hoc search or create a new one.
Position & Size
You can use your mouse to change the size or location of the visualization, or the Position & Size section of the Configuration panel for pixel perfect sizing and placement.
General
- Use Null Values to do one of the following:
- Show markers for any disconnected data points a gap.
- Connect null data points to zero data points.
- Connect them to the next positive data point.
-
Use the following Stack Mode (area charts only) options:
Stack option Column or bar appearance Use case Unstacked Areas for different series share the same space on the chart. An unstacked chart is useful for a lower number of series. As the number of series increases, the chart can become more difficult to understand. Stacked Each series area is shown separately. Use a stacked area chart to highlight the relative volume, frequency, or importance of a series. See the stacked chart example below. Stacked 100% The chart shows distribution percentage for each series over the whole data set. Use stacked 100% to focus on data distributions. - Show Data Values
Choose whether to show no data values, all data values, or only the minimum and maximum data values.
Axes
- Use X Axis title to name your x-axis.
- Use Y Axis title to name your y-axis.
Legend
- Use Position to choose the position of the legend.
- Use Truncation to choose how legend labels are truncated when they overflow the layout boundaries by choosing where to place ellipses (...)
Drilldown
Drilldown for a line or area chart lets users click on a part of the chart to open an internal or external URL.
Code
Select your visualization or its search to view and edit the source code in real-time.
Source options for line and area charts
While some of these options can be set using the visual editor, there are additional options that can only be set in the source editor for viz.line
and viz.area
. These options are added to the options
field of the visualization stanza. For example, the following example shows the addition of foreground color and font color settings using a hex code:
"viz_25NNIqLF": { "type": "viz.line", "options": { "foregroundColor": "#0000FF", "fontColor": "#0000FF" }, "dataSources": { "primary": "ds_gcEN4c7Q" } }
Line chart options
The following options are available for editing line charts in the source editor:
Property | Type | Default | Description |
---|---|---|---|
annotation.categoryColors | object | N/A | Map comma-delimited, hexadecimal color values to specified categories. For example, {"count": "#ff0000","percent": "#cb3b43"} .
|
axisY2.enabled | boolean | false | Enable a y2-axis for chart overlays. |
axisY2.fields | string | N/A | Specify a field to map to a second y-axis for chart overlays. |
axisY.includeZero | boolean | false | Specify whether the y-axis range includes zero. |
axis2Y.includeZero | boolean | false | Specify whether the y2-axis range includes zero. |
axisY.maximumNumber | (number | auto) | auto | Specify the maximum number for the visible y-axis range. |
axisY2.maximumNumber | (number | auto) | auto | Specify the maximum number for the visible y2-axis range. |
axisY.minimumNumber | (none | auto) | auto | Specify the minimum number for the visible y-axis range. |
axisY2.minimumNumber | (none | auto) | auto | Specify the minimum number for the visible y2-axis range. |
axisY.scale | (linear | log) | linear | Specify the scale type that applies to a numerical y-axis. |
axisY2.scale | (linear | log) | linear | Specify the scale type that applies to a numerical y2-axis. |
axisTitleX.text | string | N/A | Specify the title of the x-axis. |
axisTitleY.text | string | N/A | Specify the title of the y-axis. |
axisTitleY2.text | string | N/A | Specify the title of the y2-axis. |
axisTitleX.visibility | (visible | collapsed) | visible | Specify whether to show the title of the x-axis. |
axisTitleY.visibility | (visible | collapsed) | visible | Specify whether to show the title of the y-axis. |
axisTitleY2.visibility | (visible | collapsed) | visible | Specify whether to show the title of the y2-axis. |
gridLinesX.showMajorLines | boolean | true | Specify whether major grid lines are visible on the x-axis. |
gridLinesY.showMajorLines | boolean | true | Specify whether major grid lines are visible on the y-axis. |
gridLinesY2.showMajorLines | boolean | true | Specify whether major grid lines are visible on the second y-axis. |
chart.overlayFields | string | N/A | Specify a field or a space or comma-delimited list of fields that to map to the y2-axis. |
chart.resultTruncationLimit | number | 50000 | Specify the number of data points rendered in a chart. |
backgroundColor | string | N/A | Specify the color used for the chart background by using the hex code. For example, "#0000FF" .
|
data.fieldListMode | (show_hide | hide_show) | hide_show | Specify the order in which to apply the fieldShowList and fieldHideList filters. |
data.fieldShowList | array | N/A | Specify a list of fields to show in the results. For example: ["#FF0000", "#000000", "#FFFFFF"] .
|
data.fieldHideList | array | N/A | Specify a list of fields to hide in the results. For example: ["#FF0000", "#000000", "#FFFFFF"] .
|
fontColor | string | N/A | Specify the color used for fonts using the hex code. For example, "#0000FF" .
|
foregroundColor | string | N/A | Specify the color used for the chart foreground by specifying the hex code. For example, "#0000FF" .
|
fieldColors | object | N/A | Specify the color used for a field by specifying the hex code. For example, {"count": "#ff0000","percent": "#cb3b43"} .
If you would like to maintain a space between two fields, you can use the backslash and quotes to surround the string and maintain the space. In this example: |
legend.labelStyle.overflowMode | (ellipsisEnd | ellipsesMiddle | ellipsisStart | ellipsesNone) | ellipsesMiddle | Specify how to display legend labels when they overflow the layout boundaries by replacing overflow text with an ellipsis. |
legend.placement | (right | left | top | bottom | none) | right | Specify the location of the legend on the panel. |
legend.mode | (standard | seriesCompare) | standard | Provides visual and behavior settings for the tooltip and legend. |
seriesColors | array | (dark and light mode defaults) ["#1E93C6", "#F2B827", "#D6563C", "#6A5C9E", "#31A35F"] | Specify the hex color codes for the bars to use in order from largest to smallest. For example, ["#FF0000","#0000FF","#008000"] .
|
drilldown | (all | none) | all | Specify whether to enable or disable drilldown for the chart. |
chart.nullValueMode | (gaps | zero | connect) | gaps | Specify how area and line charts handle null values. |
chart.showDataLabels | (none | all | minmax) | none | Specify whether you want line charts to display no labels, all labels, or only the min and max labels. |
chart.showMarkers | boolean | true | Specify whether to show markers in line charts. |
field DashStyles | (solid | shortDash | shortDot | shortDashDot | shortDashDotDot | dot | dash | longDash | dashDot | longDashDot | longDashDotDot) | solid | Specify a dash style to use for each field. For example, '{"count":"longDashDot", "percent":"longDashDotDot"}' .
|
field DashStyle | (solid | shortDash | shortDot | shortDashDot | shortDashDotDot | dot | dash | longDash | dashDot | longDashDot | longDashDotDot) | solid | Specify a dash style for all line series in the chart. |
layout.splitSeries | boolean | false | Set to true to split a multi-series chart into separate charts that are stacked from top to bottom; one for each series.
|
layout.splitSeries.allowIndependentYRanges | boolean | false | Specify whether split series charts have independent y-ranges. |
lineWidth | number | 2 | Specify the line width, in pixels, for all of the lines in a series. |
Area chart options
The following options are available for editing area charts in the source editor:
Property | Type | Default | Description |
---|---|---|---|
annotation.categoryColors | object | N/A | Map comma-delimited, hexadecimal color values to specified categories. For example, {"count": "#ff0000","percent": "#cb3b43"} .
|
areaFillOpacity | number | 0.75 | Specify the opacity for the area fill using numbers between and including 0 and 1. This relates to the opacity percentages in the visual editor. 0 is transparent and 1 is completely opaque. |
axisY2.enabled | boolean | false | Enable a y2-axis for chart overlays. |
axisY2.fields | string | N/A | Specify a field that you want to map to a second y-axis for chart overlays. |
axisLabelsY2.integerUnits | boolean | false | Specify whether to extend the y2-axis to include whole major tick marks. |
axisY.includeZero | boolean | false | Specify whether the y-axis range includes zero. |
axis2Y.includeZero | boolean | false | Specify whether the y2-axis range includes zero. |
axisY.maximumNumber | (number | auto) | auto | Specify the maximum number for the visible y-axis range. |
axisY2.maximumNumber | (number | auto) | auto | Specify the maximum number for the visible y2-axis range. |
axisY.minimumNumber | (none | auto) | auto | Specify the minimum number for the visible y-axis range. |
axisY2.minimumNumber | (none | auto) | auto | Specify the minimum number for the visible y2-axis range. |
axisY.scale | (linear | log) | linear | Specify the scale type that applies to a numerical y-axis. |
axisY2.scale | (linear | log) | linear | Specify the scale type that applies to a numerical y2-axis. |
axisTitleX.text | string | N/A | Specify the title of the x-axis. |
axisTitleY.text | string | N/A | Specify the title of the y-axis. |
axisTitleY2.text | string | N/A | Specify the title of the y2-axis. |
axisTitleX.visibility | (visible | collapsed) | visible | Specify whether to show the title of the x-axis. |
axisTitleY.visibility | (visible | collapsed) | visible | Specify whether to show the title of the y-axis. |
axisTitleY2.visibility | (visible | collapsed) | visible | Specify whether to show the title of the y2-axis. |
gridLinesX.showMajorLines | boolean | true | Specify whether major grid lines are visible on the x-axis. |
gridLinesY.showMajorLines | boolean | true | Specify whether major grid lines are visible on the y-axis. |
gridLinesY2.showMajorLines | boolean | true | Specify whether major grid lines are visible on the second y-axis. |
chart.overlayFields | string | N/A | Specify a space, or a field or, comma-delimited list of fields that should be maps to the y2-axis. |
backgroundColor | string | N/A | Specify the color used for the chart background by using the hex code. For example, "#0000FF" .
|
data.fieldListMode | (show_hide | hide_show) | hide_show | Specify the order in which to apply the fieldShowList and fieldHideList filters. |
data.fieldShowList | array | N/A | Specify a list of fields to show in the results. For example: ["#FF0000", "#000000", "#FFFFFF"] .
|
data.fieldHideList | array | N/A | Specify a list of fields to hide in the results. ["#FF0000", "#000000", "#FFFFFF"] .
|
fontColorstring | string | N/A | Specify the color used for fonts (axis labels, legends) using the hex code. For example, "#0000FF" .
|
foregroundColor | string | N/A | Specify the color used for the chart foreground by specifying the hex code. For example, "#0000FF" .
|
fieldColors | object | N/A | Specify the color used for a field by specifying the hex code. For example: {"count": "#ff0000","percent": "#cb3b43"} .
If you would like to maintain a space between two fields, you can use the backslash and quotes to surround the string and maintain the space. In this example:
|
legend.labelStyle.overflowMode | (ellipsisEnd | ellipsesMiddle | ellipsisStart | ellipsesNone) | ellipsesMiddle | Specify how to display legend labels when they overflow the layout boundaries by replacing overflow text with an ellipsis. |
legend.placement | (right | left | top | bottom | none) | right | Specify the location of the legend on the panel. |
legend.mode | (standard | seriesCompare) | standard | Provides visual and behavior settings for the tooltip and legend. |
seriesColors | string | Dark mode: "#212527" , Light mode: "#FFFFFF"
|
Specify the hex color codes for the area chart. For example:
|
drilldown | (all | none) | all | Specify whether to enable or disable drilldown for the chart. |
chart.nullValueMode | (gaps | zero | connect) | gaps | Specify how area and line charts handle null values. |
chart.stackMode | (default | stacked | stacked100) | default | Specify stacking options. |
chart.resultTruncationLimit | number | 50000 | Specify a limit for the number of data points rendered in a chart. |
chart.showDataLabels | (none | all | minmax) | none | Specify whether you want area charts to display no labels, all labels, or only the min and max labels. |
chart.showLines | boolean | true | Specify whether you want lines to show in area charts. |
layout.splitSeries | boolean | false | Set to true to split a multi-series chart into separate charts that are stacked from top to bottom; one for each series.
|
layout.splitSeries.allowIndependentYRanges | boolean | false | Specify whether split series charts have independent y-ranges. |
Default properties
In addition to the settings in the options
field, there are two default fields that you can set. These are not options, but should be placed at the same level as the options
field.
showProgressBar
shows a progress bar as a visualization loads and is set to false
by default.
showLastUpdated
shows the last time the visualization was refreshed and is set to false
by default.
You can enable these features by adding the properties to a visualization, and changing the settings to true
.
In the following example, the visualization will override the default for showProgressBar
and show a progress bar as it loads.
"viz_tpRnLS1I": { "type": "viz.line", "showProgressBar": true, "options": { "showSparkline": false, "backgroundColor": "#ffffff" }, "title": "Does have a progress bar", "description": "Due to viz override", "dataSources": { "primary": "ds_o7IqGHcO" }
PREVIOUS Charts |
NEXT Bar and column charts |
This documentation applies to the following versions of Splunk® Dashboards App: 0.8.0, 0.9.0
Feedback submitted, thanks!