How to Change the Font Color of X-axis and Y-axis in Chart js

How to Change the Font Color of X-axis and Y-axis in Chart js

Chart JS

2 года назад

9,833 Просмотров

How to Change the Font Color of X-axis and Y-axis in Chart js

In this video we will cover how to change the font color of the x-axis and y-axis in chart js. The default color is slightly dark grey but often you might want to make it black of even give it special color sequences. Chart.js has build in features that allows us to do this. We will be changes the font color of the label ticks and even use a interesting trick.

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. A special thank you to
Nhật Triều for asking this question here: https://youtu.be/osI-dtqoizc

▬ 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: https://youtu.be/pFuibt5HNog
Starting Code: https://www.chartjs3.com/docs/chart/getting-started/

▬ 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: https://www.chartjs3.com/chart-js-blog/
Website: https://www.chartjs3.com
Udemy Course: https://www.udemy.com/course/chart-js/?referralCode=56B57F673E9D41FF4AD2

Chart JS tutorials for Beginners:
🎓 Beginners Serie: https://www.youtube.com/watch?v=W6ai7wu5VIk

Chart JS tutorials for Intermediate:
👁️ Most Watched Chart JS Video: https://www.youtube.com/watch?v=4jfcxxTT8H0
⭐ Personal Favorite Chart JS Video: https://www.youtube.com/watch?v=PuFYW1yHzl4

Chart JS Dashboard Series:
👍 Most Liked Video Series:
Watch Part 1: https://youtu.be/l3MnVpiHXBU​​
Watch Part 2: https://youtu.be/fDUo-LbrRSo​​
Watch Part 3: https://youtu.be/xlt5dDa8rz4

▬ 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: https://www.chartjs3.com

▬ Chart JS 3.6.0 ▬▬▬▬▬▬▬▬▬▬▬▬

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.6.0.

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.

Тэги:

#how_to_change_the_font_color_of_the_x-axis_and_y-axis_in_chart_js #change_the_font_color_of_the_x-axis_and_y-axis_in_chart_js #font_color_of_the_scales_labels_in_chart_js #chart_js_tutorial #chartjs_3 #chart_js_3 #chart.js_3 #chartjs_3.6.0 #chart_js_3.6.0 #chart.js_3.6.0
Ссылки и html тэги не поддерживаются


Комментарии:

Angel Joaquin Velasco Gomez
Angel Joaquin Velasco Gomez - 18.08.2023 22:03

Hi, How to change the color of the label on hover?

Ответить
Uxybab
Uxybab - 26.06.2023 21:17

Hello, thx for the video. Is there a chance to change the color for only a special value. i. e. the values are numbers from 1 to 10, and if the value is 7 it changes to red color for only this one value.

Ответить
thèm gái xinh
thèm gái xinh - 23.05.2023 11:36

I want to color different at the same position on Y-axis. Ex: đ1,000,000 (¥303.03) with đ1,000,000 is blue and (¥303.03) is red. Can do that on chartjs? THank you.

Ответить
Fadhila
Fadhila - 02.01.2023 06:26

hi, is there any other alternative that isn't using coding?

Ответить
TAMIL CYPTO MARK
TAMIL CYPTO MARK - 01.01.2023 18:23

How to set the button to change the border-radius of the bars

Ответить
Idris Abdul-Lateef
Idris Abdul-Lateef - 21.05.2022 15:20

This video helped solved a problem I've been on for days. Such great content!

Ответить
Hakuna Matata
Hakuna Matata - 19.05.2022 15:40

hi...it's not working lol

Ответить
Dave Wong
Dave Wong - 30.04.2022 13:32

Thanks for the video this was great. Can we customize the axis? Maybe with a graphic or custom html? I need the axis to show bars of colour.

Ответить
Alden Poole
Alden Poole - 27.04.2022 20:54

Currently, when I add a custom x scale to scales:{}, it changes how the chart digests my datasets x values and completely messes up my lines.

My chart data object is like

chartData = { labels: yLabels, datasets: chartDataSets }

where yLabels is an array that sets labels for the Y axis. chartDataSets is an array of datasets where inside, the data is structured like so:

data:[{y: yValue, x: xValue}, {y: yValue2, x:xValue2}]

This configuration works without changing anything, I even have two custom y axis in scales{}. When I add anything to customize the x axis (say, I want to change the font size and font weight), my x axis loses all of the labels that were set by default in the data, puts it on a 1-10 scale, and all of my datasets are sandwiched between 0 and 1 on the x axis.

I have tried setting max and min values and stepsizes, but none of this works. It seems to really mess with how the x axis is constructed- only by trying to customize the labels. Is there already an answer you can point me to? Or a forum? Or is this a simple fix?

Thanks in advance

Ответить
Bang Aji
Bang Aji - 08.03.2022 09:05

u really help. thank you so much

Ответить
Cabra Web
Cabra Web - 23.02.2022 04:59

Hello, this was really helpful. I would like to change colors of Y and X axes, when I activate Dark mode in my site. The problem is that text color get gray and we can see the content.

Thank for your help

Ответить
dreamdivine
dreamdivine - 05.01.2022 00:09

How would we change the fontsize of y-axis? I have a graph were only every other bar is labeled. It is because the graph is smaller and it works fine when I make the graph bigger but I feel like if I change the y-axis label font size to little bit smaller, may be all the words would show up??

Ответить
Thedc _
Thedc _ - 28.12.2021 15:18

And thenx u are good work 🤘🤘🤘

Ответить
Thedc _
Thedc _ - 28.12.2021 15:18

Good my friend

Ответить
Miss Pratibharana
Miss Pratibharana - 13.11.2021 15:04

Thank you so much, You really make a great video .😊😊

Ответить