Author: Zen and the Art of Computer Programming
1 Introduction
overview
Plotly is an open source-based visualization library that can easily create beautiful charts and share them on web pages, or embed them in other websites or apps. While the functionality provided by Plotly is powerful, creating complex, interactive dashboards still requires some technical skills. This article will demonstrate how to use Google BigQuery to get data from Big Data and make interactive dashboards with Plotly. The article will gradually introduce the principle and usage of each component.
data preparation
To demonstrate the effect, let's assume we have the following requirements:
- Get data from Google Analytics and store in Big Query.
- Create an interactive dashboard, including histograms of three statistical indicators of "traffic", "page views" and "user-generated content".
- Use the drop-down box to select the data of different time periods for display.
Next, we need to create SQL statements to query the required statistical data. You can design different SQL statements according to your business needs. Here is an example:
SELECT
STRFTIME_UTC_USEC(CONCAT(%Y-%m-%d,'T', %H), TIMESTAMP_SECONDS(visitStartTime)) as visitDate,
COUNT(*) as pageViews
FROM `myproject.ga_sessions_*`
WHERE _TABLE_SUFFIX BETWEEN '20200101' AND '20200131'
AND NOT REGEXP_CONTAINS(pagePath, '(feed|blog|rss)')
GROUP BY visitDate;
The above SQL statement is used for