Hy there,
I needed some kind of sparkline for an application and decided to use SVG image to get it.
I donโt know if it will be the best way, or if anyone has a better solution.
To create the image I used a formula in Gsheet:
Blockquote
=โdata:image/svg+xml;utf8,<svg xmlns=โโhttp://www.w3.org/2000/svgโ" preserveAspectRatio="โxMidYMin meetโ" viewBox=""-5 -5 118 โ&MAX(B7:G7)*10+20&โ โโ width="โ100%โ" height="โ100%โ" >
<line x1="โ3"โ y1="""&MAX(B7:G7)10&""" x2="โ3"โ y2="""&(MAX(B7:G7)-((B7MAX(B7:G7)))/MAX(B7:G7))*10&""" style="โstroke:blue;stroke-width:6"โ />
<line x1="โ23"โ y1="""&MAX(B7:G7)10&""" x2="โ23"โ y2="""&(MAX(B7:G7)-((C7MAX(B7:G7)))/MAX(B7:G7))*10&""" style="โstroke:blue;stroke-width:6"โ />
<line x1="โ43"โ y1="""&MAX(B7:G7)10&""" x2="โ43"โ y2="""&(MAX(B7:G7)-((D7MAX(B7:G7)))/MAX(B7:G7))*10&""" style="โstroke:blue;stroke-width:6"โ />
<line x1="โ63"โ y1="""&MAX(B7:G7)10&""" x2="โ63"โ y2="""&(MAX(B7:G7)-((E7MAX(B7:G7)))/MAX(B7:G7))*10&""" style="โstroke:blue;stroke-width:6"โ />
<line x1="โ83"โ y1="""&MAX(B7:G7)10&""" x2="โ83"โ y2="""&(MAX(B7:G7)-((F7MAX(B7:G7)))/MAX(B7:G7))*10&""" style="โstroke:blue;stroke-width:6"โ />
<line x1="โ103"โ y1="""&MAX(B7:G7)10&""" x2="โ103"โ y2="""&(MAX(B7:G7)-((G7MAX(B7:G7)))/MAX(B7:G7))*10&""" style="โstroke:blue;stroke-width:6"โ />
<text x="โ0"โ y="""&MAX(B7:G7)*10+10&""" fill="โredโ" font-size="โ9"โ font-family="โVerdanaโ">"&B7&" <tspan x="โ20"โ y="""&MAX(B7:G7)*10+10&""">"&C7&" <tspan x="โ40"โ y="""&MAX(B7:G7)*10+10&""">"&D7&" <tspan x="โ60"โ y="""&MAX(B7:G7)*10+10&""">"&E7&" <tspan x="โ80"โ y="""&MAX(B7:G7)*10+10&""">"&F7&" <tspan x="โ100"โ y="""&MAX(B7:G7)*10+10&""">"&G7&" <line x1="โ0"โ y1="""&MAX(B7:G7)*10+1&""" x2="โ108"โ y2="""&MAX(B7:G7)*10+1&""" style="โstroke:rgb(1,1,1);stroke-width:0.5"โ /> "
Blockquote
Not the best solution but I didnโt find a way to do it in Appsheet. If anyone can help me, I appreciate it.
The end result is something like this:
@Jonathon has lots of SVG experience and might like this example as well.
Update:
I think using the Google API (deprecated in 2012, but it work) we got a better solution.
https://developers.google.com/chart/image/docs/making_charts
Here is a comparison between the two options, using a virtual column with the formula:
"https://chart.googleapis.com/chart?cht=bvs:nda&chs=180x100&chd=t:"
&[V_0]&","&[V_1]&","&[V_2]&","&[V_3]&","&[V_4]&","&[V_5]& "&chco=0000FF&chm=N,ff0000,0,-1,9,,e::10|o,ff0000,0,-1,6"
I hope it is useful for someone.
This is great, thanks @Sergio_Sa!
Hi @Sergio_Sa,
Earlier @Jonathon had shared some interesting charting possibilities with SVG. Now you have further extended it by adding Google Chart APIs. Thank you both for sharing these interesting charting possibilities insights.
Youโre welcome @Peter and @Suvrutt_Gurjar . Good thing itโs useful.
I am still learning how to work with Appsheet and have realized that there are so many possibilities that we ended up doing more than we initially anticipated.
The possibility exists, getting it is more difficult.
Would this be possible also with https://quickchart.io/ ?
Thatโs really really neatโฆ Do you think if the whole community starts using it, we could rate limit since all the calls would be coming through appsheet? Regardless itโs even cheap to host if thatโs an issueโฆ Really cool find!
โThere is a built-in rate limit of 240 charts/min (4 charts/sec) per IP.โ