Introduction
Today, I am going to demonstrate how to build an area chart in Javascript/jQuery. I hope it will be helpful. This chart can be used to build BI/Business Intelligence, graphical representation of data, etc. To build an area chart, we will be using JavaScript/jQuery library, which is Chart JS. Since it will be based on Javascript, it can be used over multiple platforms like SharePoint Online, Project Online, ASP.NET Applications, Open source platforms like Java, PHP, etc. Thus, let's get to the topic.
Step 1
(Libraries)
First, we need to get the required libraries. We can download these libraries from jQuery CDN, Chart.JS CDN. To build this chart, we will be using jQuery v1.12.4 and Chart.js v2.5.0.
- <script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.bundle.min.js"></script>
Step 2
(Markups)
Chart js uses canvas to draw the chart. Thus, we will be using a canvas tag for the same.
- <div class="chartBox">
- <canvas id="AreaChartDom" width="600" height="300"></canvas>
- </div>
Step 3
(Scripts)
Dataset
First, we need to prepare the data set for the chart. We can define the data set, as shown below.


Join the conversation! Your thoughts help the community grow.