How to Create an Indicator Based on Values in Chart JS

preview_player
Показать описание
How to Create an Indicator Based on Values in Chart JS

In this video we will explore how to create an indicator based on values in chart js. Often in Dashboards having a chart and an indicator to track the status is a common item.

We will add arbitrary lines that would indicate the range and based on the value a status is assigned. To achieve this we will need to create a custom plugin to draw arbitrary lines. Once we did that we will need to analyze what the last value is from the line chart. With that we can define and assign the correct status.

Let's explore how to do this.

▬ Chartjs Viewers Question Series ▬▬▬▬▬▬▬▬▬▬

This is part of the Chartjs Viewers Question series. Where we answer viewer questions. This question was asked by one of our viewers.

▬ Materials/References ▬▬▬▬▬▬▬▬▬▬

To keep the video short we might expect you to know parts. These parts we have explained in other videos. You can find the references here below:

▬ Got a Question? Comment! ▬▬▬▬▬▬▬▬▬▬

Got a question or special request about a specific item? Comment below and tell me your question. I will make sure to follow up on you!

▬ Find Me Here ▬▬▬▬▬▬▬▬▬▬

Chart JS tutorials for Beginners:

Chart JS tutorials for Intermediate:

Chart JS Dashboard Series:
👍 Most Liked Video Series:

▬ About Us ▬▬▬▬▬▬▬▬▬▬▬▬

Why we created these #chartjs and #javascript video tutorials?

WHY
Creating charts in javascript is very rewarding but extremely challenging. The Chart JS library made it easier to render charts. However the chart js documentation is hard to understand for many. It requires a lot of different moving parts to work along. The canvas tag, javascript, arrays and Chart JS all need to be combined to draw an eye catching bar chart or line chart.

The videos explains the chart js documentation in a more visual and easy to understand way. You can follow along with the code and quickly grasp how it works. We cover the code in chart js but also what truly happens and why something happens when we write a line of code. This fundamental understanding gives clarity to you as a developer in chartjs. In short it is the Chart JS video documentation.

HOW
We answer questions from YOU (viewers) by creating an answer video that covers the questions YOU have posted in the comment section.

WHAT
Our goal is to help YOU learn how to draw charts in Chart JS by showing you in video format how to do it.

▬ Chart JS 3.7.1 ▬▬▬▬▬▬▬▬▬▬▬▬

Chart JS is a javascript library to draw charts in the canvas tag on your site. Presenting data in a visual manner such as charts is more effective and appealing. All the charts are always coded in the latest Chartjs version which is as of this recording Chart JS 3.7.1.

What type of charts can you make with Chart.JS?
With chart js you can make line chart, bar chart, pie chart, doughnut chart, scatter chart, polar area chart, radar chart, gauge chart and area chart. And with some clever tricks and visual adjustment more can be done.
Рекомендации по теме
Комментарии
Автор

My man I would like to remind you that you have some outstanding skills in ChartJS. You are doing great video tutorials explaining and showing how the things are working! Keep doing your job! You are doing amazing things with ChartJS!

ВолодимирПриходько-лл
Автор

Very nice,
is it possible to make the tracker on the (x, y) point color for exemple red for danger green .. ?

youcefcozy
Автор

Hi,

I am trying to add a title to the plugins area but I am not sure how with the [statusTracker] being an array and needed the plugins to be an object. Whatever I try always breaks the graph. ANy help would be appreciated.

Thanks!

JohnnyBriones
Автор

Hi Thanks for ur videos, can you make a video of how to set starting x-axis value ... For Example I have data like {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} I need to show only 5 to 10

sirbusy
Автор

Hi! Great videos!

In your graph, you can see how the line graph goes under the red line but goes over the yellow line. Is there a way to control this? If I want the graph line to always go over the drawn straight lines or go under them? Thanks!

JohnnyBriones
Автор

nice bro thank you :)
u are a fast man haha good job
appreciate it

how u did, that the status span is right next to the chart, how can i do this?
my span is under the canvas. how can i postion this items where ever i want?

leonma
Автор

hey bro
i have one more question
how can i replace the background color of the status box?
for example when the current (last) value is i the danger zone the background color gets red
when the last value is in perfect zone the background color gets green

leonma