Trouble sending paired data values through URL parameter

Hello! I have created a horizontal floating bar chart with specific start and end points for each bar as paired values. I’ve created the following chart (see code below): https://quickchart.io/chart/render/sf-4d02ec3b-7f08-40ff-95f4-6a277abf1833.

I would like to update the values with URL parameters, but am having trouble getting it to work, as it seems to be taking only the first three values and assuming 0 as the starting value. I’ve also tried to subset paired values with the url encoded [ or ( without luck (this results in no data plotted).

Thanks for any assistance!

Code:

{
type: ‘horizontalBar’,
data: {
labels: [‘S 1’, ‘S 2’, ‘S 3’],
datasets: [
{
label: ‘Ages Affected’,
backgroundColor: ‘rgba(54, 162, 235, 0.5)’,
borderColor: ‘rgb(54, 162, 235)’,
borderWidth: 1,
data: [
[10, 23],
[5,26],
[23,79]
],
},
],
},
options: {
responsive: true,
legend: {
position: ‘top’,
},
title: {
display: true,
text: ‘Chart.js Bar Chart’,
},
},
}

Attempts with data parameter:

Hi @ajhmohr, we just deployed a change that enables support for the “list of lists” (aka paired data values) format in templates.

For example:

https://quickchart.io/chart/render/sf-4d02ec3b-7f08-40ff-95f4-6a277abf1833?data1=[[10,20],[5,10],[70,80]]

Hope this helps!

Amazing! This is exactly what I was looking for! Thank you so much!

1 Like