Radial Gauge / "Meter" - Inline Dynamic Icon - How to create?

Dear community,

On various occasions, we wish to have some sort of KPI so that the user can get the better experience and insight. Most of the โ€œiconโ€ is basically โ€œstaticโ€, but I found a way to create KIP radial gauge type of Icon, based on the data in Appsheet column/data field. This is super easy.

Borrowing code from ; -

This is Javascript open-source library, and they have bunch of chart image type. Among other, I use Radial Gauge meter to place the same an icon for inline display the same gauge.

It looks like this.

2X_f_f391df0f7d9a773f85cdc8a80fd1766fa8956c38.png

First, please create virtual column and insert following texts.

โ€œhttps://quickchart.io/chart?c={type:โ€˜radialGaugeโ€™,data:{datasets:[{data:[Number or Float type data field],backgroundColor:โ€˜greenโ€™}]}}โ€

โ€“

For the part of [Number or Float type data field], please refer to the data fileld you wish to show as KPI. For instance, the percent of achievement, kind of number should be best fitting for this kind of KPI indicator.

And make the column type to either IMAGE or THUMBNAIL.

Or you can hard-code the number as well optionally.

Thats it.

Bit of customise we ca like a color. Just change the last part of code, like โ€˜redโ€™ or โ€˜blueโ€™ etc

This is the easiest trick to place KPI indicator to the view .

Try it out.

I will test the other chart, but most of the type are on the Appsheet default chart features can manage, so it may not be useful, but if any user wish to have chart as INLINE, rather than Chart view, this javascript liberary could be found useful.

If anyone in the community to test this and found new tricks and tips, it is grateful if they share the finding in this post, thanks.

Additional Note

The texts in the vc looks like this fyg.

โ€œhttps://quickchart.io/chart?c={type:โ€˜radialGaugeโ€™,data:{datasets:[{data:["&[Percent]&"],backgroundCo...]}}โ€

This case i have column callced โ€œ[Percent]โ€, i refer it in the strings and concat.

I tested another simple chart from the library, like bar chart. It looks like this within Appsheet detail view. Chart is now shown as inline!

32 60 6,996
  • UX
60 REPLIES 60

Wonderful, thank you!

Hi Taylor

I''ve some data listed below

IDNameActual 1Actual 2Actual 3Actual 4Target
1David90929598100

Is it possible to make radar chart in appsheet, based on that data?

I want the result like this

IvanCruz_0-1643612995486.png

 

Thanks, for your help

Hello tsuji_koichi! I found your post very helpful. I was wondering if you might be able to help me solve this- Iโ€™m trying to set the color for my radial gauge to be conditional on a certain score from another column using an IF() formula. To test this out, Iโ€™m just trying to get a score of 1 from [Urgency] to show red on the chart. Is this possible? Am I on the right track?

โ€œhttps://quickchart.io/chart?c={
type:โ€˜radialGaugeโ€™,
data:{datasets:[{
data:[โ€&[Progress RW]&"],
backgroundColor:["& IF([Urgency]=1,โ€˜redโ€™,โ€˜greenโ€™) &"]
}]},

options:{
trackColor: โ€˜whiteโ€™,

centerArea:{
fontColor:โ€˜whiteโ€™,
fontSize:85,
}

}

}โ€

I think the single quotes are being stripped away when the expression is evaluated. But they are needed in the final URL.

Try adding double-quotes around the single-quotes.

"'green'"

Single quotes are working fine when itโ€™s just-
backgroundColor: โ€˜greenโ€™

Itโ€™s only when I add the If statement that things break. I tried adding double quotes around the single quotes like you suggested-
backgroundColor:["& IF([Urgency]=1,"โ€˜redโ€™","โ€˜greenโ€™") &"]

No luck. I also tried additional quotes on the other side of the & to make a more obvious concatenation-
backgroundColor:["&โ€œIF([Urgency]=1,โ€˜redโ€™,โ€˜greenโ€™)โ€&"]

That didnโ€™t work eitherโ€ฆ Wondering if the entire IF() needs to be wrapped in something? Square braces didnโ€™t work.

โ€œhttps://quickchart.io/chart?c={
type:โ€˜radialGaugeโ€™,
data:{datasets:[{
data:[โ€&[Progress RW]&"],
backgroundColor:["& IF([Urgency]=1,โ€˜redโ€™,โ€˜greenโ€™) &"]
}]},

options:{
trackColor: โ€˜whiteโ€™,

centerArea:{
fontColor:โ€˜whiteโ€™,
fontSize:85,
}

}

}โ€

Pushing the Appsheet expression is making things more complicated. I suggest you create the virtual column to calculate your if statement, for example [Color] field, then you anchor that field within expression.

This makes a lot of sense. I tried it and itโ€™s pushing me an error. In the main column I have-

โ€œhttps://quickchart.io/chart?c={
type:โ€˜radialGaugeโ€™,
data:{datasets:[{
data:[โ€&[Progress RW]&"],
backgroundColor:["&[Color]&"]
}]}, โ€ฆ

This is the same syntax as data: in the previous line, which works. Also tried backgroundColor:[Color].

In the Color virtual column, to simplify things for testing purposes I just put โ€˜blueโ€™-

Iโ€™ve tried this without quotes and with double quotes. Also tried changing the type to Color, that definitely breaks things.

I think this is the right idea, Iโ€™m just not executing it properly.

You are passing โ€œbackgroundโ€ color parameter value in the form of ARRAY instead of the text value.

I m not able to validate this expression with me, so not tested. However try this.

โ€œhttps://quickchart.io/chart?c={
type:โ€˜radialGaugeโ€™,
data:{datasets:[{
data:[โ€&[Progress RW]&"],
backgroundColor:"&[Color]&"
}]},
options:{
trackColor:โ€˜whiteโ€™,

centerArea:{
fontColor:โ€˜whiteโ€™,
fontSize:85,
}

}

}"

Got it- no ARRAY brackets in the url, and in the Color virtual column I did what Joseph suggested and wrapped the single quoted color in double quotes- " โ€˜redโ€™ ".

Thanks for the help! Moving on to incorporate the IF statementโ€ฆ

Good to know you get through.

Recently I try. IF statement in background color. Itโ€™s work

data:
{
    datasets:[{
    data:[โ€,[Progress]*100,"],
    borderWidth:2,
    backgroundColor:"&IF([Progress]<0,' "Red" ',' "Green" ')&"
    }]

},

You need to adding single-quotes around the double-quotes.

' "Green" '

Hello Mr Koichi

iยดm tryng to use this API, but when i Replace (70) by the column PPCM wich is my % KPI the image dosnยดt appear. What show is a square with 3 letters like "ceE" or "exp". Would you help me?

Try this instead.

CONCATENATE(
โ€œhttps://quickchart.io/chart?c={type:โ€˜radialGaugeโ€™,data:{datasets:[{data:[โ€,
NUMBER([VC Offset Percentage]),"],
backgroundColor:โ€˜Greenโ€™}]},options:{ title: {
display: true,
text:โ€˜Energy Usage Offsetโ€™
},
trackColor: โ€˜rgb(255,0,0)โ€™,centerPercentage: 70,roundedCorners: false,
centerArea:
{
text:โ€™ โ€œ,NUMBER([VC Offset Percentage]),โ€%25โ€™},
fontSize:70
}
}"
)

That didnโ€™t work but this did. Thanks!

CONCATENATE(
โ€œhttps://quickchart.io/chart?c={type:โ€˜radialGaugeโ€™,data:{datasets:[{data:[โ€,
NUMBER([VC Offset Percentage]),"],
backgroundColor:โ€˜Greenโ€™}]},options:{ title: {
display: true,
text:โ€˜Energy Usage Offsetโ€™,fontSize:70
},
trackColor: โ€˜rgb(255,0,0)โ€™,centerPercentage: 70,roundedCorners: false,
centerArea:
{
text:โ€™ โ€œ,NUMBER([VC Offset Percentage]),โ€%25โ€™},
}
}"
)

Good.

As far as my experience is concerned, max font size could be something like 75 based on texts numbers, such as 5% 10% 100%.
Once you apply large font size, it is a risk the image chart return the NO text in the middle.

Try different number of font size which perfectly fit with your case.

Got it. Thanks for your help.

I did try without the brackets, sorry I posted the ARRAY attempt as my post, it was a moonshot.

Anyone know of a way to throw an image in the center rather than the text?

Instead of text you can use Emojis. Would that be a solution for you?

hello Koichi

I''ve some data listed below

IDNameActual 1Actual 2Actual 3Actual 4Target
1David90929598100

Is it possible to make radar chart in appsheet, based on that data?

I want the result like this

IvanCruz_0-1643612737608.png

 

Thanks, for your help

Good day.

I use this code

The texts in the vc looks like this fyg.

โ€œhttps://quickchart.io/chart?c={type:โ€˜radialGaugeโ€™,data:{datasets:[{data:["&[Percent]&"],backgroundCo...]}}โ€

 

the UX card, but istead of gauge in each lie oly can see a square with:     ecE

Top Labels in this Space