Histogram
A histogram visualizes the distribution of continuous data by grouping values into bins and displaying their frequency. This topic covers basic histogram configurations and examples.
Overview
A histogram uses vertical bars of varying heights to display data distribution based on frequency, count, or other statistics along the x-axis. Unlike a column chart, a histogram focuses on statistical analysis. Key differences:
-
A histogram shows data distribution. A column chart compares values across categories.
-
The x-axis of a histogram represents continuous numerical data (length, weight, time). The x-axis of a column chart represents categorical data (request methods).
-
Histogram bars have little or no gap between them because the data is continuous. Column chart bars have gaps to distinguish categories.
To add a chart to a dashboard, follow the steps in Add a chart to a dashboard.
Try it out
The SLS Playground provides built-in histogram demos. Click the following links to try them out.
-
Histogram with multi-dimension stacking and merging
ImportantThe data in the SLS Playground is for demonstration purposes only. Do not use this data in a production environment.
Configuration examples
Basic histogram
Log on to the Simple Log Service console. In the Projects section, click the project you want.

-
In the left-side navigation pane, choose . In the Dashboard list, click the dashboard you want. In the upper-right corner of the dashboard page, click Edit. In edit mode, choose .
-
On the right, configure settings in the Chart Type and Query and Analysis Configurations panels. On the left, set the time range, select a Logstore, enter your query, and then click Apply to view the chart.
In the Query and Analysis Configurations section on the right, set Axis X Field to
tand Axis Y Field toc.If the x-axis represents time, enable Time Series Mode. In this mode, Simple Log Service automatically formats the time values and displays the data distribution over time. The following query statement calculates the number of records in 30-minute intervals:
* | select __time__ - __time__ % 1800 as t, COUNT(*) as c group by t order by t asc limit 10000
Multi-dimension stacking
Log on to the Simple Log Service console. In the Projects section, click the project you want.

-
In the left-side navigation pane, choose . In the Dashboard list, click the dashboard you want. In the upper-right corner of the dashboard page, click Edit. In edit mode, choose .
-
On the right, configure settings in the Histogram Settings and Query and Analysis Configurations panels. On the left, set the time range, select a Logstore, enter your query, and then click Apply to view the chart.
Enable Time Series Mode and select charts-demo as the Logstore. In the Histogram Settings section, set Direction to Vertical, Time Scale to Relative time, Time Selection to 1 Minute, Merge Columns to Stacked, and Transparency to 85. In the Query and Analysis Configurations section, set Axis X Field to t, and select GET and POST for Axis Y Field.
The following query statement calculates the number of GET and POST requests per minute:
* | select __time__ - __time__ % 60 as t, count_if(request_method = 'GET') as GET, count_if(request_method = 'POST') as POST group by t order by t asc limit 1000
General configurations
These settings apply to the entire histogram.
-
Basic configurations
Parameter
Description
Title
The chart title.
Display Title
Shows the chart title when enabled.
Display Border
Shows a border around the chart when enabled.
Display Background
Shows a background color for the chart when enabled.
Display Time
Shows the query time in the chart when enabled.
Fixed Time
Locks the query and analysis time range so that it is not affected by the dashboard's global time setting.
-
Standard configurations
Parameter
Description
Format
The display format for numbers.
Unit
The unit for numbers.
Number of Digits after Decimal Point
The number of decimal places for numbers.
Display Name
The display name for the field.
This name overrides all other field names in the chart. To rename a specific field, use field configuration.
Color Scheme
The color scheme for the chart.
-
Built-in: Uses the built-in colors.
-
Solid: Uses a single color.
-
Threshold: Colors the chart based on configured thresholds.
-
-
Histogram settings
Parameter
Description
Direction
The orientation of the histogram. Valid values: Vertical and Horizontal.
Coordinate Scale
The x-axis interval. Applies only in non-Time Series Mode.
Time Scale
The time scale. Applies only in Time Series Mode.
Select Time Range
The time interval. Applies only in Time Series Mode.
Buckets
The number of buckets.
In non-Time Series Mode, if you set the Coordinate Scale, the number of buckets is not required.
Rotation angle
The rotation angle of the text on the x-axis.
This parameter is required when Direction is set to Vertical.
Merge Columns
With multiple Y-axis fields, use the Merge Columns setting to configure how bars are stacked.
-
No: Each bar starts from the bottom of the chart.
-
Yes: Bars are merged into one.
-
Stacked: Bars are stacked without overlapping.
Line Width
The width of the bar borders.
Transparency
The transparency of the histogram.
Gradient Mode
The gradient mode of the histogram.
-
Transparency: Applies a gradient based on the bar color and Transparency setting.
-
No Gradient: Fills bars with a solid color.
-
-
Query and analysis configurations
Parameter
Description
Axis X Field
The field for the x-axis.
Default: automatically selected by SLS.
Axis Y Field
The field for the y-axis. Specify multiple fields to generate a grouped histogram.
Default: automatically selected by SLS.
-
Legend configurations
Parameter
Description
Display Legend
Turn on the Display Legend switch to display the legend.
Sorting Method
The display order of legend items in the chart. Valid values: No Sorting, Ascending, and Descending.
Legend Position
The position of the legend.
Actions
The behavior when you click a legend item.
-
Single: Clicking a legend item shows only that item's data.
-
Switch: Clicking a legend item toggles its visibility.
Maximum width (height)%
The maximum width and height of the legend.
-
-
Tooltip configurations
Parameter
Description
Sorting Method
The arrangement order of the data in the tooltip that appears when you hover over a bar.
Valid values: No Sorting, Ascending, and Descending.
Display Mode
The display mode of tooltip data.
Applies when you hover over a bar.
-
Axis x
Parameter
Description
Display Axis X
Turn on the Display Axis X switch to display the x-axis.
Axis X Title
The title of the x-axis.
Format
The time format for the x-axis. Applies only in Time Series Mode.
Axis X Height
The height of the x-axis.
Default: automatically set by SLS.
Drag and Zoom
In Time Series Mode, after you drag to zoom in, you can refresh the global time or the time for the current chart.
-
Axis y
Parameter
Description
Display Axis Y
Turn on the Display Axis Y switch to display the y-axis.
Axis Y Title
The title of the y-axis.
Axis Y Position
The position of the y-axis.
Axis Y Width
The width of the y-axis.
Default: automatically set by SLS.
Maximum Value
The maximum value of the y-axis.
Default: automatically set by SLS.
Minimum Value
The minimum value of the y-axis.
Default: automatically set by SLS.
Elastic Maximum Value
The elastic maximum value of the y-axis. Takes effect only when all y-axis values are less than this value.
Default: automatically set by SLS.
Elastic Minimum Value
The elastic minimum value of the y-axis. Takes effect only when all y-axis values are greater than this value.
Default: automatically set by SLS.
Axis Y ID
The Y-axis ID. The value can be any string. In General Configurations, this field typically has no effect. To define multiple Y-axes, configure them in Field Configuration. Y-axes with different IDs display as separate axes.
The Y-axis ID takes precedence over the unit configuration in Standard Configurations. Two Y-axes with the same unit are merged into one. Two Y-axes with the same unit but different IDs display separately.
-
Variable substitution
Parameter
Description
Variable substitution
Variable substitution adds a variable-type filter to the chart. After configuration in General configurations, a filter appears in the upper-left corner of the chart. When you select a value, Simple Log Service replaces the variable in the query statement and reruns the analysis. Example 2: Set variable substitution.
-
Documentation
Parameter
Description
Add Documentation Link
Adds a documentation link to the upper-right corner of the chart.
Field configuration
Field configurations apply custom visualization settings to a specific query result or data column. For parameter descriptions, see General configurations.
For example, you can customize the bar color for a specific y-axis field. A > GET indicates that you are configuring the GET field from query A. A > POST indicates that you are configuring the POST field from query A.
Interactions
Configure interaction occurrences for a query result or data column to enable drill-down analysis. Supported interactions include Open Logstore, Open Saved Search, Open Dashboard, Open Trace Analysis, Open Trace Details, and Create Custom HTTP URL. Add interaction occurrences to a dashboard for drill-down analysis.
For example, A > GET configures an interaction for the GET field from query A. If the interaction for the GET field is set to Open Logstore, clicking a GET value in the histogram and then clicking Open Logstore navigates to the specified Logstore.