How to create a fancy line chart

A line chart displays the top 10 largest economies by average values of GDP

A line chart, also known as a line graph, is an effective chart for visualizing data over time. It is one of the most commonly used chart types in data analysis and visualization, for many good reasons, such as being easy to create, understand, highlight trends, etc.
Another good reason to use a line chart is that it is beneficial for individuals with cognitive impairment, as it is cognitive friendly.
Let me explain, the following chart displays the top 10 largest economies by average values of GDP:

This demo could be easily created using a bar race chart. Bar race charts are popular on social media thanks to their wow factor. However, line charts are better if only communicating the data is the primary goal, which is not always the case. The line chart above is easily understood because there is no timer to run the chart like the bar race chart, the stress dimension due to the timer is removed. Everyone can go at his/her pace to get insight from a line chart by comparing the dataset and examining the trends. In other words, the line chart is cognitively friendly despite the significant amount of data.

Now, let’s see how to create such a chart.

To create such a chart, I went through the following steps:

  1. Reverse yAxis to get the country order from number one (on top) to the last one(at the bottom). To do that, I set reversed to true
      yAxis: {
        reversed: true,
        gridLineWidth: 0,
        tickInterval: 1,
        startOnTick: false
  2. Set up the option opposite to true on the xAxis
      xAxis: {
        opposite: true,
        offset: 10
  3. Align the legend next to each line on the right side using the legend’s option layout:
      legend: {
        align: "right",
        verticalAlign: "middle",
        layout: "proximate",
        itemStyle: {
          color: "#FFFFFF",
          fontWeight: "bold"

In summary, line charts are a simple and effective way to visualize data over time. They are easy to understand and cognitively friendly. It is not surprising that line charts are widely used in data analysis, business and management, economics, and other fields.