You are on page 1of 2

a!

localVariables(
local!states: { "AP", "Telangana", "Tamil Nadu" },
local!selectedState: "AP",
local!apData: {
{
label: "Total Confirmed Cases",
value: 256000
},
{ label: "Total Cured Cases", value: 210000 },
{ label: "Total Deaths", value: 20000 }
},
local!telanganaData: {
{
label: "Total Confirmed Cases",
value: 265000
},
{ label: "Total Cured Cases", value: 220000 },
{ label: "Total Deaths", value: 200 }
},
local!TamilNadu: {
{
label: "Total Confirmed Cases",
value: 2560
},
{ label: "Total Cured Cases", value: 21 },
{ label: "Total Deaths", value: 20 }
},
local!dataArray: a!refreshVariable(
value: if(
local!selectedState = "AP",
local!apData,
if(
local!selectedState = "Telangana",
local!telanganaData,
local!TamilNadu
)
),
refreshOnVarChange: local!selectedState
),
{
a!dropdownField(
label:"State",
placeholder: "Select a State",
choiceLabels: local!states,
choiceValues: local!states,
value: local!selectedState,
saveInto: local!selectedState
),
a!columnsLayout(
columns: a!forEach(
local!dataArray,
a!columnLayout(
contents: {
a!cardLayout(
contents: {
a!richTextDisplayField(
align: "CENTER",
value: index(local!dataArray, fv!index, "label", null)
),
a!richTextDisplayField(
value: a!richTextItem(
text: index(local!dataArray, fv!index, "value", null),
color: "POSITIVE",
style: "STRONG"
),
align: "CENTER"
)
}
)
}
)
)
),
a!columnsLayout(
columns: {
a!columnLayout(
contents: a!barChartField(
label: "Covid Data",
categories: index(local!dataArray, "label", {}),
series: a!forEach(
local!dataArray,
a!chartSeries(
label: index(local!dataArray, fv!index, "label", null),
data: index(local!dataArray, fv!index, "value", null)
)
)
)
),
a!columnLayout(
contents: a!pieChartField(
style: "DONUT",
label: "covid Distribution",
series: a!forEach(
local!dataArray,
a!chartSeries(
label: index(local!dataArray, fv!index, "label", null),
data: index(local!dataArray, fv!index, "value", null)
)
)
)
)
}
)
}
)

You might also like