9 Cool Things You Can Do with Line Chart in Exploratory

You can learn various things you can do with Line chart in this post.

  • Date / Time Aggregation
  • Aggregation Methods
  • Multiple Lines by Color
  • Multiple Lines by Multiple Columns
  • Multiple Charts by Category (Subplot)
  • Trend Line
  • Reference Line
  • Window Calculation Methods
  • Missing Values Handling

Note that most of them are not specific to Line chart, you can do pretty much the similar things with other chart types like Bar, Area, Scatter plot as well.

Date / Time Aggregation

Round Date / Time

The default is to aggregate the data points by the rounded Year. Actually, it is floor, so any day of 2018 will be considered as 2018, for example.

You can change this to other levels like Month, Week, Day. etc.

Extract Date / Time Components

You can extract each component of Date and Time information. For example, here I’m extracting Month Name component of Date information.

This extracts only the month names (Jan, Feb, etc.) and strips out all others such as Year, Day. So essentially, you are focusing on the monthly trend.

Aggregation Function for Y-Axis

The default is to calculate the number of the rows for each data point of X-Axis.

You can assign a column and select one of the aggregation functions listed for Y-Axis.

Different Calculation Methods for Different Data Types

This list is differnt based on the data type.

Here is a list of the aggregate functions for Logical data type column. I’m assigning a column that indicates whether a given flight was delayed or not and selecting ‘Number of TRUEs’ function. We can see how many flights were delayed on each day.

We can swtich to ‘% of TRUEs’ instead to see what is the percentage of the flights that were delayed on each day.

Multiple Lines by Color

You can assign a categorical column to Color to break down the data. Here, I’m breaking it down to multiple lines.

You can see the legend showing up at the right hand side that indicates what each color means. You can change the position of the legend.

Multiple Y-Axis Columns

You can assign multiple columns to Y-Axis.

You can assign up to 5 columns. When you assign multiple columns to Y Axis you can’t use Color By since the multiple columns use Color to differentiate the multile lines.

Dual Y-Axis: Y1 and Y2 Axis

Sometimes the scales can be very different between two columns if you assigned both of them to Y1.

You can assign one of them to Y2, which will allow the two columns values to be displayed with different scales.

Select ‘Y1/Y2 Assignment’ from the Y Axis menu. of the column you want to assign to Y2 Axis.

Check ‘Assign to Y2’.

This will assign the column to Y2 Axis with a different scale from the Y1 scale.

Marker - Line to Bar / Circle

You can change the marker for each Y Axis Column. For example, here I’m setting the first Y Axis column to use Bar marker.

And here, I’m setting it to Circle.

You can access Marker Setting from the Y Axis menu.

Multiple Line Charts (Subplot)

You can use Repeat By to show the chart divided into multile categories and line them up to compare among them.

Layout

Sometimes, the charts layout might not be the way you want to see.

You can adjust the layout.

First, you can set how many columns you want to use for the layout. For example, I’m setting it to use 5 columns layout.

Scale

When you are trying to compare the trend you might not care about the absolute scales. In such cases, you can uncheck ‘Sync Y Axis Among Charts’ to re-adjust each Y Axis scale to match with the data for each chart.

Missing Value Handling

Trend Line

You can show a trend line for each line.

You can access to Trend Line Setting dialog from Y Axis menu.

There are different methods to calculate the trend line. Exploratory supports the following three.

  • Linear Regression
  • GAM
  • Polynomial

GAM and Polynomial tend to make the line more smooth along the base line while Linear Regression always draw a straight line.

Regardless of the methods, it builds a predication model behind the scene to draw the trend line. This means that you can see some of the model quality metrics in the pop-up when you move the mouse over on the line.

Trend Line with Color By

You can show the trend line for each color line.

Reference Line

You can show a reference line

You can access to Reference Line Setting dialog from Y Axis menu.

Select one of the methods to calculate the reference line.

You can use ‘Constant’ by scrolling down when you want to set a static value.

You can adjust the style (Color, Line width, Line style) by scrolling down in the dialog.

Window Calculation

There are various window calculation methods you can use to calculate the values for the lines on the fly.

  • Cumulative
  • % of
  • Difference From
  • % Difference From
  • Moving Average

For example, here is a stock price data and I’m showing each company’s adjusted stock price trend using different colored lines.

Since the price ranges between two groups - one group (AMZN/Amazon and GOOG/Google) and another group (AAPL/Apple, FB/Facebook, and MSFT/Microsoft) - are very different, it is hard to compare which stocks are performing better or worse.

Instead, we can show how much they grow in a percentage term.

Select Window Calculation from Y Axis menu.

Select % Difference From

By selecting ‘First Value’, which is the default by the way, we can now see how much each stock price has performed easier.

This ‘% Difference From - First Value’ method is to calculate the difference between a value at any given point and the first value for a series of the values for each color line, in this case that is the stock.

So the calculation is something like the below.

(adjusted - first(adjusted)) / first(adjusted) * 100

There are other methods I’d recommend you try out. Take a look at this post for more details.

Time Series Range Slider

This is planned for v5.0 release.