Introducing PopSQL + dbt. The first SQL editor with built-in dbt supportRead more →

How to Make Charts to Visualize Your Data

After you run a query, look for the Chart button to create a chart.

Line chart

Let's look at how many questions are asked per day on StackOverflow:

select *
from `bigquery-public-data.stackoverflow.posts_questions`
where creation_date between '2020-01-01' and '2020-01-31'

line chart

If we wanted to see two series, one for answered questions, and another for unanswered questions, we need an answered boolean column:

select
  *,
  answer_count > 0 as answered
from `bigquery-public-data.stackoverflow.posts_questions`
where creation_date between '2020-01-01' and '2020-01-31'

line chart two series

Here's a video tutorial showing how to create a line chart:

Bar chart

Let's look at the top 10 most popular tags on StackOverflow and make a bar chart.

select *
from `bigquery-public-data.stackoverflow.tags`
order by count desc
limit 10

bar chart

Pie chart

Using the results from the previous pie chart example, here's what it would look like if we changed the chart type to a pie chart:

Combo Chart

Given a chart with two distinct sets of data with the same x-axis, like the data set below:

dayordersratings
2021-01-037584
2021-01-0474152
2021-01-06135145
2021-01-0585135
2021-01-07140155

You can now create charts that have two y-axes. For example, this chart has a bars representing the number of orders on the left y-axis, and a line representing the number of ratings on the right y-axis.

combination chart showing two datasets

Big Number Chart

If you just want to show a number in your chart, generally to make a dashboard more clear, you can use the big number chart: combination chart showing two datasets

Chart Colors

When creating your chart, we will automatically give each series a color from a pre-defined palette. However, you are free to customize the colors to best fit your needs. When editing the chart, you will see within the right sidebar a box next to the series that allows you to set its color. For combo charts as well as bar, line, and scatter charts when not using the group by feature, you will see the color selector next to the columns you've selected for your Y-Axis. For pie charts, as well as bar, line, and scatter when using the group by feature, there will be a new "Colors" section on that will allow you to pick a color for the automatically generated series. For big number charts, you can customize the text color of the number by entering the fomatting menu, and then inputting colors there that correspond to specific numerical conditions, such as the number being less than some value.

sidebar demonstrating colors

Ready for a modern SQL editor?