Это видео недоступно.
Сожалеем об этом.
Fetch and Display Advanced JSON Data in Chart JS
HTML-код
- Опубликовано: 19 сен 2021
- Fetch and Display Advanced JSON Data in Chart JS
In this video we will explore how to fetch and dusplay advanced JSON data in Chart.js. The goal is to explore how to get layers deep of JSON data and extract them as needed. We will be displaying the JSON data in Chart.js using async fetch. To do this we need to create a JSON file before we can use it with Chart.js.
We will be fetching data and parsing JSON data so Chart.js can read it. Once you use the fetch command to extract the data from the file. The way we go around this is quite similar if we would connect to an outside JSON file based on an API which also needs fetch. The topic is quite complicated but we take it slow and make it easy to follow. However, it is worth to learn as this will open up many new doors.
Let's explore this right now!
▬ 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. This question was asked by Joenel Espejo. A special thank you for asking this question. You can find the question here asked on this video: • How to create a Matrix...
▬ 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:
Understand setup, config and render init blocks: • How to use config and ...
Starting Code: www.chartjs3.c...
▬ 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 ▬▬▬▬▬▬▬▬▬▬
Blog: www.chartjs3.c...
Website: www.chartjs3.com
Udemy Course: www.udemy.com/...
Chart JS tutorials for Beginners:
🎓 Beginners Serie: • ChartJS intro creating...
Chart JS tutorials for Intermediate:
👁️ Most Watched Chart JS Video: • Update dynamic chart j...
⭐ Personal Favorite Chart JS Video: • How to make an interac...
Chart JS Dashboard Series:
👍 Most Liked Video Series:
Watch Part 1: • How to make a chart dy...
Watch Part 2: • How to make a chart dy...
Watch Part 3: • How to add a dynamic c...
▬ 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 Video Documentation Site: www.chartjs3.com
▬ Chart JS 3.5.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.5.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.
This video uses a JSON File. You can copy the code below and save the files as a JSON file. So you can easily follow along.
{
"year": "2021",
"financialreport": [
{
"company": "ChartJS",
"companyname": "ChartJS Corp",
"companystock": "CHRT",
"financials":
[
{
"date": "January",
"revenue": 90,
"expenses": 30,
"profits": 60
},
{
"date": "February",
"revenue": 120,
"expenses": 30,
"profits": 90
},
{
"date": "March",
"revenue": 150,
"expenses": 30,
"profits": 120
},
{
"date": "April",
"revenue": 180,
"expenses": 30,
"profits": 150
},
{
"date": "May",
"revenue": 210,
"expenses": 30,
"profits": 180
},
{
"date": "June",
"revenue": 240,
"expenses": 30,
"profits": 210
},
{
"date": "July",
"revenue": 270,
"expenses": 30,
"profits": 240
}
]
}
]
}
Really enjoyed this tutorial. Thanks for sharing. Very well presented and a clear demonstration :)
Really good job
Is there a good way to only fetch certain values from for example "profits"? Lets say I only want to fetch the values over 150 profit, whats a good way to do so?
Really helpful. I am trying to add a second data series, but they both have the key data?
i get cors error while calling api from another url, how to fix these please help
Does the same method is followed to fetch json data for progressive line chart? Orelse can you please explain how it can be done to fetch the json data for progressive line chart? @Chart JS
Hello Sir. Can you please do that for radar chart ?
How can I make a bar chart that shows how many of the data we have in the ranges we want?
how to render chart from javascript object can you make video on that?
Could you show how to create two doughnut charts based on the json? For example if the json had two companies listed instead of the one.
Hello.. how do I format the values of the data array in monetary decimal format? Example, R$ 2.500,00 ?
Hi Universo, thank you for your question. I have created an answer here: ruclips.net/video/3zhMQVaAVw4/видео.html
how to host json file locally?
JSON-server
how to display the fetched data into a table or box
great tutorial !
I get blank page
Gape horn