Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70754

In chart.js, how do I add data to a chart based on its date?

$
0
0

@markbackhouse wrote:

I have an array of objects, each containing the date (using new Date()) in which the object was added to the array.

I want to show a bar chart that tells you how many of these objects were added in any given week.

So if I added four new objects to my array this week, I want this week’s section of the bar chart to display 4, and so on.

I was thinking of making each weekly interval on the axes a Sunday-to-Sunday width, but I am unsure how to specify this in Chart.js. Further, I have no idea how to count the number of each object that should go into each interval, thus forming the vertical heights of each bar. Is anyone able to help? Thanks!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70754

Trending Articles