Skip to main content
Version: 0.32.2

Explore Data with the Chart Builder

The Chart Builder is a great way to start exploring your data and identifying trends. In this example, we'll explore the data about the passengers aboard the Titanic.

Load Our Data

First, let's load the "Titanic Dataset" CSV file into our session.

titanic dataset

Create a Simple Scatter Chart

First, let's explore the relationship between a passenger's age and the fare they paid to board the Titanic. We can use the steps below to create a scatter plot showing each passenger's age and the fare they paid. We'll also split the passengers by gender and add a slider (which lets us manipulate the value of a specific variable) so we can see how each of the passenger classes compare:

  1. Click Plot in the sidebar to open the Chart Builder.
  2. Select "Scatter Chart" for the type.
  3. Under Required Fields, enter "Age" for the X-Axis and "Fare" for the Y-Axis.
  4. Under Optional Fields, enter "Gender" for the Group and "Pclass" for the Slider.
  5. Click Submit.

scatter plot

We can see that, predictably, the fares are lower as you move from first class to second class to third class. What's interesting here is that the fares for women (the blue dots) seem to be generally be higher for men (the gold stars) across the classes. Let's explore that trend with some light computations and a new chart.

Compute and Then Plot

Let's compute the average fare paid by each gender for each passenger class:

  1. Click Dataset > Compute in the sidebar to open the Compute form.
  2. Enter "average" for the aggregate, "Fare" for the column, and "AvFare" for the new column name.
  3. Select "Gender" and "Pclass" for the grouping columns.
  4. Click Submit.

compute form

The resulting "titanic_Compute" dataset looks like this:

compute dataset

Now, let's use a bar chart to compare the average fare paid by men and by women in each passenger class:

  1. Click Plot in the sidebar to open the Chart Builder
  2. Select "Bar Chart" for the type.
  3. Under Required Fields, enter "Pclass" for the X-Axis and "AvFare" for the Y-Axis.
  4. Under Optional Fields, enter "Gender" for Group.
  5. Click Submit.

compute plot

Edit a Chart

We make our chart more clear by changing the title name, axis names, and adding a note of our findings:

  1. Click the Edit mode button in the bar chart's more menu.

    edit mode button

  2. Under Customize, rename the Chart Title to "Average Fare v Passenger Class for each Gender" and rename the Y-Axis to "AvFare".

    edit title and axis names

  3. Double-click Add Text and enter "On average, women's fares are higher than men's regardless of class".

    add text

  4. Click Submit.

We can see that the trend we noticed earlier holds true. This chart clearly illustrates that, on average, women paid more than men regardless of their class.

Full Recipe

You can copy all of the steps we used in this example here:

Load data from the file <strong>titanic.csv</strong>
Plot an EChart with the specification <strong>{"caption":"","typeVersion":2,"plot":{"series":[{"type":"scatter","mark":{"x":"Age","y":"Fare","shape":"Gender","color":"Gender"},"group":{"slider":"Pclass"}}],"presentation":{"title":{"textStyle":{"fontSize":18},"text":["Fare vs. Age, clustured using: Gender"]},"xaxis":{"nameTextStyle":{"fontSize":18},"axisLabel":{"fontSize":12},"text":"Age"},"yaxis":{"nameTextStyle":{"fontSize":18},"axisLabel":{"fontSize":12},"text":"Fare"},"annotations":[],"colorOverride":[]}},"values":{"complete":false,"metadata":{},"columns":[{"name":"Age","type":"Float","unique":89},{"name":"Cabin","type":"String","unique":148},{"name":"Embarked","type":"String","unique":4},{"name":"Fare","type":"Float","unique":248},{"name":"Gender","type":"String","unique":2},{"name":"Name","type":"String","unique":891},{"name":"Parch","type":"Integer","unique":7},{"name":"PassengerId","type":"Integer","unique":891},{"name":"Pclass","type":"Integer","unique":3},{"name":"SibSp","type":"Integer","unique":7},{"name":"Survived","type":"Integer","unique":2},{"name":"Ticket","type":"String","unique":681}],"aggregate":[{"expression":"None","columns":["Fare"],"groupBy":["Age","Gender","Pclass"]}],"transforms":[],"reference":{"type":"dataset","params":{"session_id":"lb7ldqdzmfri1tg8","dataset":"titanic","version":1}}}}</strong>
Compute the average Fare for each Gender, Pclass and call the computed columns AvFare
Plot an EChart with the specification <strong>{"caption":"","typeVersion":2,"plot":{"series":[{"type":"bar","mark":{"x":"Pclass","y":"AvFare","shape":"Gender","color":"Gender"},"group":{}}],"presentation":{"title":{"textStyle":{"fontSize":18},"text":["Average AvFare vs. Pclass, for each: Gender"]},"xaxis":{"nameTextStyle":{"fontSize":18},"axisLabel":{"fontSize":12},"text":"Pclass"},"yaxis":{"nameTextStyle":{"fontSize":18},"axisLabel":{"fontSize":12},"text":"Average AvFare"},"annotations":[],"colorOverride":[]}},"values":{"complete":false,"metadata":{},"columns":[{"name":"AvFare","type":"Float","unique":6},{"name":"Gender","type":"String","unique":2},{"name":"Pclass","type":"Integer","unique":3}],"aggregate":[{"expression":"Average","columns":["AvFare"],"groupBy":["Pclass","Gender"]}],"transforms":[],"reference":{"type":"dataset","params":{"session_id":"lb7ldqdzmfri1tg8","dataset":"titanic_Compute","version":1}}}}</strong>
Modify the <strong>chart</strong> <strong>Figure2</strong> with the metadata <strong>{"series":[{"type":"bar","mark":{"x":"Pclass","y":"AvFare","shape":"Gender","color":"Gender"},"group":{}}],"presentation":{"title":{"textStyle":{"fontSize":18},"text":"Average Fare v Passenger Class for each Gender"},"xaxis":{"nameTextStyle":{"fontSize":18},"axisLabel":{"fontSize":12},"text":"Pclass"},"yaxis":{"nameTextStyle":{"fontSize":18},"axisLabel":{"fontSize":12},"text":"AvFare"},"annotations":[{"type":"text","text":"On average, women's fares are higher than men's regardless of class","fontSize":16,"left":"59.75496176647479%","top":"50.813270543415%","linex":null,"liney":null,"width":909.296875,"height":590.59375,"invisible":false,"interactable":true,"lineInvisible":null}],"colorOverride":[]},"caption":"","transforms":[],"aggregate":[{"expression":"Average","columns":["AvFare"],"groupBy":["Pclass","Gender"]}]}</strong>