Skip to content

Tag: chart.js

How to set ChartJS Y axis title?

I am using Chartjs for showing diagrams and I need to set title of y axis, but there are no information about it in documentation. I need y axis to be set like on picture, or on top of y axis so someone could now what is that parameter I have looked on official website but there was no information

How to display data values on Chart.js

Is it possible using Chart.js to display data values? I want to print the graph. Thanks for any advice.. Answer There is an official plugin for Chart.js 2.7.0+ to do this: Datalabels Otherwise, you can loop through the points / bars onAnimationComplete and display the values Preview HTML Script Fiddle –…

Chart.js — drawing an arbitrary vertical line

How can I draw an vertical line at a particular point on the x-axis using Chart.js? In particular, I want to draw a line to indicate the current day on a LineChart. Here’s a mockup of the chart: http://i.stack.imgur.com/VQDWR.png Answer Update – this answer is for Chart.js 1.x, if you are looking …

Different color for each bar in a bar chart; ChartJS

I’m using ChartJS in a project I’m working on and I need a different color for each bar in a Bar Chart. Here’s an example of the bar chart data set: Is there any way to paint each bar differently? Answer After looking into the Chart.Bar.js file I’ve managed to find the solution. I&#821…

How to add text inside the doughnut chart using Chart.js?

How to render Text inside the doughnut chart, I am using ChartJs. Answer You have to modify the code like: in chart.Doughnut.defaults and then in function drawPieSegments ctx.fillText(data[0].value + “%”, width/2 – 20, width/2, 200); See this pull: https://github.com/nnnick/Chart.js/pull/35 …