I need the value of chart show after name of data for example ([colour of data] Car 50, [colour of data] Motorcycle 200). I’ve tried change the value of legend title but it doesn’t work at all Here is it my code: Answer You can use a custom generateLabels function for this:
Tag: chart.js
How can I divide this Object.values with the total?
I have this where car is 2 and total is 12. So I wanted to get the percentage of this but this is in an Object.values(res) I wanted the dataset in the graph to be in a percentage value. Let’s say car is 2 and the total is 12. So it should be 16.66%. However, in my dataset right now,
chartjs time cartesian axis adapter and date library setup
I am trying to implement this tutorial and could not get it done. https://www.chartjs.org/docs/latest/axes/cartesian/time.html Input: list of objects with (time,value) attributes. Time is Integer that means unix time in seconds; value is Float. The tutorial says “Date Adapters. The time scale requires both a date library and a corresponding adapter to be present. Please choose from the available adapters”. Date
Chart.JS tooltip callbacks label and title (v3.5)
(Please note: There are lots of answers for v2, this is for v3) I’m trying to setup tooltips label and title for a doughnut chart. Code: The label now works, and displays the value of the data, but the title is returning blank, instead of returning the label of the data (“Positive” or “Other”). How can I return the correct
Putting label array to the chartjs?
I have these codes: let arr = []; This is what console.log(arr); shows: [“Item1”, “Item2”, “Item3”, “Item4”] Below is my graph: How can I loop through the object arr to be put inside the labels? Answer The charts label receives a string or an array of strings: So you will put your array directly to the labels like so: A
How to style specific gridlines differently in chartJs?
I am using chartJS to draw a bubble chart with an x axis running from -5 to +5 and a y axis running from -5 to +5. I was able to change the grid line styling using to get this result. my chart output so far I need to have the X and Y axis at 0 on both to
Error with Chartjs radar pointLabels color Scriptable
Refering to documentation (3.4.1) the color of labels in chartjs radar chart is a scriptable and customizable via options.scales.r.pointLabels.color, I have been trying to set a different label color for each tick. The problem is that when passing a function as the property value as explained in the scriptable documentation the context does not contain the property dataIndex (as is
Chart.js – disable tooltip when cursor moves outside the main canvas
I have a line chart and I set up my tooltip like this It works fine. The problem I have is that when I move my cursor to the x-axis ticks, which are outside the main plot/canvas, the tooltips stills appear. I’ve tried to set intersect: true but then the tooltip only shows up when I hover directly over the
Line graph with linear timescale in Chart.js
I’m trying to use Chart.js 3.3.2 to display some a line graph with an equally spaced x date axis. Like the example they give here. I cannot get a simple version of this example working (see below snippet) as it outputs the error: Error: This method is not implemented: Check that a complete date adapter is provided. I did not
Chart.js – Unable to see tooltips on hover while using moment
I have created a line chart and on hover of the points am not able to see the tooltips. It seems to throw error while hovering on line points. TypeError: Cannot read property ‘format’ of undefined So far I was able to render the line chart with time data which required the adapters. As per the docs, tried changing the