Configure a donut chart
A donut chart is a pie chart with a hollow center that displays a total value or other key information.
Prerequisites
-
Data is collected. Collect text logs from a server.
-
An index is created. Create an index.
-
A dashboard is created. Create a dashboard.
Overview

-
Query and analyze: Query and analyze logs in the console — retrieve, aggregate, and generate statistics.
-
Configure a donut chart: Select donut as the pie chart type, configure the chart, and add it to your dashboard.
Step 1: Query and analyze
Log on to the Simple Log Service console. In the Projects section, click the project you want.

-
In the navigation pane on the left, click Log Storage. In the Logstores list, click the target Logstore.
-
Enter the following query statement to calculate page views (PVs) by browser type, and click Search & Analyze.
* | select count(1) as pv, case when http_user_agent like '%Chrome%' then 'Chrome' when http_user_agent like '%Firefox%' then 'Firefox' when http_user_agent like '%Safari%' then 'Safari' else 'unKnown' end as http_user_agent group by case when http_user_agent like '%Chrome%' then 'Chrome' when http_user_agent like '%Firefox%' then 'Firefox' when http_user_agent like '%Safari%' then 'Safari' else 'unKnown' end order by pv desc limit 10
Step 2: Configure a donut chart
-
In the navigation pane on the left, choose . In the Dashboard list, click the target dashboard. In the upper-right corner of the dashboard, click Edit and then choose .
-
On the right side of the page, choose . On the left side, configure the time range, Logstore, and query statement. Then, click Apply at the top of the page to preview the chart.
-
: Select Donut Chart.
-
: Select Percentage to display values as a percentage, such as 1.98%.
-
: Enable this option to display value labels on the chart.
This query uses
CASE WHENto grouphttp_user_agentby browser type (Chrome, Safari, Firefox) and count PVs per browser. Select website_log from Logstore (SQL) as the data source and set the time range to Last 15 Minutes. -