New Year Offer: Pay for 1 & Get 3 Months of Unlimited Class Access

- Tableau Blogs -

How To Create A Line Chart In Tableau?

In this article, we are going to talk about what is a line chart, how to create a line chart, and formatting the line chart. Along with these, we will also talk about when to use the line chart and alternatives available for the line chart.

What is a line chart?

The line chart is one of the most used charts in visualization. Majorly we use the line chart to show the trend also. Along with that, if you have a lot of bars in the bar chart then you may try the line chart also. A line chart can also be used when one of your axes is a function of time.

For example, let’s say you want to create a yearly sales trend, monthly profit trend, profit/sales ratio for the function of time. In all such cases, you can create a line chart.

The best thing about Tableau is, when you drag dimensions or measures, Tableau automatically suggest you the best chart available. For example, if you will use a date field and a measure then there are high chances that the suggested chart will be a line chart.

When to create a line chart?

A line chart can be created in the following scenarios-

  • You have a date field on one axis and a measure on the other axis
  • Need to show some trends as a function of time
  • The requirement is to just see the trend and not much on the actual values
  • When you have a lot of points on the x-axis then also line chart can be one of the preferable charts.

How to create a line chart?

Let’s create a line chart for the following requirements-

We need to create a monthly sales report. As we need the monthly report and so, you need to use the order date dimension which will be auto aggregated on the year. But as we need the monthly data and so you need to change the year to month so that you will be getting something like Jan 2018, Feb 2019, etc.

To do that, just click on it and you will find many formats of the date. If you are not satisfied with the format given, you may select more and can select from other formatting options available.

Read: How to Create & Format Tableau Worksheet?

Once done, just drag the sales measure to the row field and you will see the line chart getting created automatically.

How to create a line chart?

As you can see in the above image, both the date field and the sales field is continuous. This is just because while converting the date in a different format, we selected it to be continuous. It’s up to you how you want to keep it.

We can talk about the difference between continuous and discrete data in some other post. For a basic brief, in Tableau, data can be either continuous or discrete. The continuous data will be shown with the green color and discrete data will be shown with the blue color.

If you have created such charts earlier, you may find that when the date field is discrete then the label will be at the top. While in the case of the continuous data, it is showing you at the bottom. So, depending on what is your requirement, you may select it to be either a continuous field or a discrete field.

Formatting the line chart

In the previous section, we simply created a line chart without much thinking on user behavior like how user-friendly it, how it can produce insight to the user, etc. But these are an important factor while developing the reports and dashboards.

In this formatting section, we will talk about all these. First of all, we can start by renaming the worksheet title and the name of the worksheet. We have discussed these earlier also while creating the worksheet like how to rename the worksheet and provide meaningful information.

Rename worksheet name and title

To rename the worksheet name, simply double click on it and change the name as a requirement. Or right-click on it and select rename and then type the new name as required. As you can see I have changed the name of the worksheet to the sales trend.

Read: How to Interact with the Content on the Tableau Server?

Now to change the worksheet title, again you may double click on it which will give you a pop-up where you can type your required name. Or you can click on the icon and select to change the name. Both works for the same purpose. I have changed the name to the monthly sales trend.

Label the report

Currently, as you can see we don’t have the value of the sales written on any line. And when you hover your mouse the respective sales values are shown to you. To show the label of those lines directly, you need to enable the label to these charts. To do that, just click on the T icon showing you at the top.

You can also enable the label of the data by clicking on the label option from the marks shelf and then enabling the checkbox. Both will enable the label to your report. The difference is, from the marks card, you will be also able to customize and format the label as per your requirement.

How to create a line chart?

Now let's say the x-axis of this chart is already showing you the month and the below to it, it is also showing the month of the order date. If you don’t want to show that, simply right-click on it and select the option edit axis. From here you can simply remove the name month of the order date. This will now only keep the month and year and the remaining title will no longer be available.

Changing Color

You can also change the color of this line chart. To change the color of the line chart, just click on the color option from the marks and select the color of your choice. Make sure to select the color which should be pleasant to the eye. And also it should make sense. For example, if you’re showing profit and loss as a function of the time. Then in such a case, it is the normal expectation that the profit will be shown with the green color and loss with red color. But if you will do the reverse, it won’t work and can give ambiguous results to the user.

How to create a line chart?

Along with all these if you want to play around more formatting options, just right-click on the line chart and select the formatting option. This will open a complete set of formatting options for you. Here you can make a change to the axis, the label like you may represent it to the unit of thousands, millions, and more. Also, you may add currency at the start as well. You can also control the decimal point while showing the values.

Read: A Complete Guide to Hierarchy in Tableau

A different variation of the line chart

So far, we have seen a single line in the line chart. Now just consider that in the same example, you need to show the sales done by the different categories. Means now we just not need the total monthly sales but also the individual sales are done by each category in different months.

This can also be achieved just by dragging the dimension category to the color shelf. This will create multiple lines in the same chart and now you will find the monthly sales trend for each category.

How to create a line chart?

As we have the 3 options in the category dimension and so you are seeing three lines here. There are more options as well to make this in other formats. For example, let’s say you want to create separate sections for these categories. To do that, you can remove the category dimension from the color shelf and add that to the row shelf. Just ensure that it is at the beginning of the row shelf and now you will find in the same graph, 3 separate sections have been created.

How to create a line chart?

These are some of the variations of the line chart which you can also use as and when required. It is advisable to keep your graph as simple as possible so that all kinds of users will be able to read and act on it.

Filtering the line chart

You may also filter the line chart the way we have filtered the other chart. In our prior articles, we have talked about filters a lot. The same you can also apply in the line chart. For example, if you have to filter this report on the state then simply drag the dimension state to the filter shelf and then enable the show filter option so that the users will be able to filter the report as per the requirements.

Conclusion

This was all about the line chart in Tableau. Here we talked about what is a line chart, when to create it, how to create it, formatting options for the line chart and more. Now go ahead and try creating the line chart and format it properly.

Read: The Best of Tips on Tableau Certification



    Janbask Training

    A dynamic, highly professional, and a global online training course provider committed to propelling the next generation of technology learners with a whole new way of training experience.


Comments

Trending Courses

AWS

  • AWS & Fundamentals of Linux
  • Amazon Simple Storage Service
  • Elastic Compute Cloud
  • Databases Overview & Amazon Route 53

Upcoming Class

2 days 22 Jan 2021

DevOps

  • Intro to DevOps
  • GIT and Maven
  • Jenkins & Ansible
  • Docker and Cloud Computing

Upcoming Class

3 days 23 Jan 2021

Data Science

  • Data Science Introduction
  • Hadoop and Spark Overview
  • Python & Intro to R Programming
  • Machine Learning

Upcoming Class

0 day 20 Jan 2021

Hadoop

  • Architecture, HDFS & MapReduce
  • Unix Shell & Apache Pig Installation
  • HIVE Installation & User-Defined Functions
  • SQOOP & Hbase Installation

Upcoming Class

2 days 22 Jan 2021

Salesforce

  • Salesforce Configuration Introduction
  • Security & Automation Process
  • Sales & Service Cloud
  • Apex Programming, SOQL & SOSL

Upcoming Class

5 days 25 Jan 2021

QA

  • Introduction and Software Testing
  • Software Test Life Cycle
  • Automation Testing and API Testing
  • Selenium framework development using Testing

Upcoming Class

2 days 22 Jan 2021

Business Analyst

  • BA & Stakeholders Overview
  • BPMN, Requirement Elicitation
  • BA Tools & Design Documents
  • Enterprise Analysis, Agile & Scrum

Upcoming Class

2 days 22 Jan 2021

MS SQL Server

  • Introduction & Database Query
  • Programming, Indexes & System Functions
  • SSIS Package Development Procedures
  • SSRS Report Design

Upcoming Class

2 days 22 Jan 2021

Python

  • Features of Python
  • Python Editors and IDEs
  • Data types and Variables
  • Python File Operation

Upcoming Class

2 days 22 Jan 2021

Artificial Intelligence

  • Components of AI
  • Categories of Machine Learning
  • Recurrent Neural Networks
  • Recurrent Neural Networks

Upcoming Class

0 day 20 Jan 2021

Machine Learning

  • Introduction to Machine Learning & Python
  • Machine Learning: Supervised Learning
  • Machine Learning: Unsupervised Learning

Upcoming Class

9 days 29 Jan 2021

Tableau

  • Introduction to Tableau Desktop
  • Data Transformation Methods
  • Configuring tableau server
  • Integration with R & Hadoop

Upcoming Class

-1 day 19 Jan 2021

Search Posts

Reset

Receive Latest Materials and Offers on Tableau Course

Interviews