I’m trying to use two api’s, one to pull information from and convert it to another one to generate a image. I’d like to use a shortcode like this:
{{< country-count type="pie" labels=["Kenya", "Sudan", "Germany"] >}}
That would generate this:
{
type: 'pie',
data: {
labels: ['Kenya', 'Sudan', 'Germany'],
datasets: [{
label: 'Count',
data: [300, 200, 250] # Retrieved from api using info from labels array
}]
}
}
Which I could use to create something like this:
https://quickchart.io/chart?bkg=white&c={ type: 'pie', data: { labels: ['Kenya', 'Sudan', 'Germany'], datasets: [{ label: 'Count', data: [300, 200, 250] }] }}
However, I’m stuck as labels=["Kenya", "Sudan", "Germany"]
does not seem to be valid input for a shortcode, I keep getting this error
got quoted positional parameter. Cannot mix named and positional parameters
Is it possible to do what I want?