Skip to content
Advertisement

Tag: chart.js

ChartJS show value in legend (Chart.js V3.5)

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:

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

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

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

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

Advertisement