Edit:
So after digging a little more I believe I found a minimal solution to your problem. I believe it would be difficult to find a library that deals with your exact situation, and the best course would be to try to format your data to fit with excepted parameters. Here is a snippet of code that I would believe would do that.
I use the package moment.js because it is widely used. https://momentjs.com/docs/
Here is the code snippet
const fourteenDaysAgo = moment().subtract(14, 'days')
let barChartArray = new Array(14).fill(0);
console.log(barChartArray)
dates.forEach((date) => {
const dateAsMoment = moment(date, 'MMM Do, YYYY')
const DateIsInFourteenDayRange = moment(dateAsMoment).isAfter(fourteenDaysAgo, 'day')
if(DateIsInFourteenDayRange) {
//initalizes a new moment that start at the beginning of the day
//checks the differences in days between now and that date
//uses that difference to populat the barChartArray
const index = moment().startOf('day').diff(dateAsMoment, 'days')
barChartArray[index]++
}
})
console.log(barChartArray)
I created a jsfiddle you can try out here: https://jsfiddle.net/h2809Ljy/208/
Here are some of the console.log statements for random data.
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[4, 3, 2, 2, 1, 1, 5, 7, 4, 2, 1, 1, 3, 1]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[2, 3, 1, 4, 4, 6, 4, 5, 8, 3, 6, 6, 2, 3]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[2, 2, 4, 6, 6, 5, 5, 5, 1, 5, 5, 5, 2, 2]
I believe this could suit your needs, and it would allow a lot of flexibility with how you display the data. If you have any more questions about this code or how to start displaying it please let me know and I'd be happy to address them!
Original:
I would recommend checking out d3! It can be a powerful library for displaying data in react but doing something simple such as a bar chart is a relatively easy process.
d3
d3: https://www.npmjs.com/package/d3
simple bar chart tutorials:
https://observablehq.com/@d3/lets-make-a-bar-chart
https://blog.logrocket.com/data-visualization-in-react-using-react-d3-c35835af16d0/
One thing that can be initially confusing about using d3 with react is that they both have their own processes for managing elements, so you have to be conscientious of that while writing code (for something simple it probably won't affect anything). I would recommend giving this article a read to understand what's going on with that (specifically the last few paragraphs). https://medium.com/noteableio/interactive-applications-with-react-d3-f76f7b3ebc71
https://betterprogramming.pub/5-steps-to-render-d3-js-with-react-functional-components-fcce6cec1411