Formatting visualizations in Databricks
1. Formatting visualizations in Databricks
In this demo, we will create a Bar Chart in Databricks and use formatting to enhance its presentation, uncovering the story behind TPCH orders. In the SQL Editor, we enter a query to calculate the total price for each order and identify the month in which the orders were made. Save this query as "2_1_demo." After running the query, we'll see the raw results, including columns for the total price of each order and the order month. Next, we create a bar chart. Choose "Order_Month" as the X column. For the Y column, select "*" and set the aggregation type to "Count" to get the count of rows. We'll see a preview on the right showing the order counts by month. However, the titles for the x and y axes are the same, which isn't correct. You can change the Y-axis title to "Count of Orders" by going to the "Y-axis" card and updating the "Name." Now it looks better. To assign different colors to the bars, use the "Group by" module. Go back to the "General" card and select "Group by" as "Order_Month". This will apply different colors to the bars. If you don't want to see the legend, turn it off by setting the "Legend placement" to "Hidden." To see the exact value for each bar, add labels by going to the "Data labels" card and checking "Show data labels." February has the lowest value of 17,335. There are additional settings you can explore, but that's the basics. Let's now apply these concepts in the exercises.2. Let's practice!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.