Hello. I am trying to create a line chart using the Chart.js plugin. I am having trouble figuring out how to chart my 5 most recent data entries …
Examples Data: 2,3,4,2,3,5,6,4,3,6,5
I only want to chart 6,4,3,6,5 on my X-axis. Any guidance would be extremely helpful.
Hello @connect4 welcome to the community!
- Count the items on the list and substract 5 from this totalCount. Let’s refer to this result as positionStart
- In the list use :items from #positionStart to get your 5 most recent items
Hello @cmarchan Thank you for the help. I forgot to mention that the list of data is dynamic. More data will be added over time. Is there a way to continue charting the 5 most recent data points as the data set grows? Thank you!
Use Items Until # 5 shown below

Hello,
The :items until #5: is pulling the first 5 points in my data set; however, I am looking to have it pull the last five (and continue to pull the last five as I add more data). Maybe I am not making a simple error somewhere. I have the logic and graph as screen shots pasted below. As you can see, the first data point on the graph is the first data point in the chart. I want the first data point to be 4 in the chart 69.04 and not 70.83 (maybe tough reference points because they are so close together. Another reference point would be the second data point - it is 58.25 but I want to pull 15.61 … hopefully that makes sense. I appreciate all of the help.

Thanks for the help! @bubble.trouble @cmarchan
You just need to sort by created date or modified date after you “Search for Sleeps”:sorted desc (before the items from #5
@bubble.trouble I am still running into the same problem … it keeps pulling the first 5 entries
It’s hard for me to tell exactly what is going on but typically you need to add a format as text (at the very end of your statement) and add a comma for the separator when using the chart libraries in Bubble
I still seem to be having trouble getting it to work. Would I be able to provide any additional context to make it easier to understand? @bubble.trouble
Post your entire Data Type structure, Screen Capture(s) with the details of your design parameters specifically the x, y outlining the data structure. Or post a link to the editor if you are willing (make sure you have the settings correct to make the app editor public) if this is a prototype and you don’t have sensitive data already in your app.
Basically, the more information you provide the easier it is to figure out what is going wrong.