Hello everyone,
I have a table BALANCE which has the columns:
Also, Iโve created a slice CURRENT_MONTH_BALANCE which has only 1 row which is the one that corresponds to the current month. So, my slice would look like this:
My intention is to have a Donut or Pie chart that will display the โspentโ vs the โremainsโ amounts.
So, in this example, the Donut or Pie chart will show a 1/4 of the pie in one color (spent) and 3/4 in another color (remains).
Butโฆ Iโm not able to make this work in AppSheet, since I just get 1 color donut/pie that sums both โspentโ and โremainsโ value (so, just one circle telling 2300 )
Ive tried both, the classic and the newer chart version, but I donโt seem to get it workingโฆ
What am I missing?
Solved! Go to Solution.
Hello again,
I managed in the end what I wanted to do and I wanted to share the learning for that.
So, it seems that ENCODEURL() does not play well with certain special characters:
#
%
+
and maybe othersโฆ
Then, instead of writing those characters, you need to write the equivalent URL encoded version of it, so:
# = %23
% = %25
+ = %2B
etcโฆ
Thanks to this, I can now use again the Hexadecimal colors, just that instead of writing it like this:
backgroundColor:
[
โ#006391โ,
โ#cccโ
]
I will write them like this instead:
backgroundColor:
[
โ%23006391โ,
โ%23cccโ
]
Here is a link to a full list of the URL encoded characters:
https://www.w3schools.com/tags/ref_urlencode.ASP
So, in case that you want to re-use what I have in the end, here it is:
CONCATENATE(
โhttps://quickchart.io/chart?c=",
ENCODEURL(
"{
type: 'doughnut',
data:
{
datasets:
[
{
data:
[
642,
2500
],
backgroundColor:
[
'%23006391',
'%23ccc'
],
borderWidth: 3
}
],
labels:
[
'Remaining',
'Spent'
]
},
options:
{
rotation: Math.PI,
circumference: Math.PI,
cutoutPercentage: 75,
plugins:
{
datalabels:
{
display: true,
color:
[
'%23fff',
'%23000'
]
},
doughnutlabel:
{
labels:
[
{
text: '\nBudget',
color: '%23006391',
font:
{
size: 25
},
},
{
text: '\n26%25',
font:
{
size: 40
},
},
]
}
}
}
}"
)
)
User | Count |
---|---|
36 | |
34 | |
27 | |
23 | |
18 |