Skip to main content

Notifications

Power Apps - Building Power Apps
Suggested answer

QuickCharts Radar Chart and For All Collection

Posted on by 58
Hi
 
Not sure if anyone has used quick charts with powerapps - I have a few times but never in the way I need to now.
I am utlising the radar chart and I am able to show one record on it no issue - however I need to be able to have a user select items from a gallery and have them all show on the radar chart as a different dataset 
 
has anyone tried this before?
 
code for one record for reference:
 
"https://quickchart.io/chart?c=" & EncodeUrl(
    "{
  type: 'radar',
  data: {
    labels: [
      'Accommodation/Living Environment',
      'Living Skills and Self Care',
      'Mental Health and Wellbeing',
      'Friends and Community',
      'Relationships and Family',
      'Drugs and Alcohol',
      'Managing Feelings and Response',
      'Positive Use of Time',
    ],
    datasets: [
      {
        backgroundColor: 'rgba(255, 255, 255, 0.5)',
        borderColor: 'rgb(75, 192, 192,1)',
        data: [" & LookUp(CriminalJusticeWeb,Date=Gallery66.Selected.Date && YPID=ViewYPSelect_10.Selected.YPID,Accomodation) & ", " & LookUp(CriminalJusticeWeb,Date=Gallery66.Selected.Date && YPID=ViewYPSelect_10.Selected.YPID,LivingSkills) & ", " & LookUp(CriminalJusticeWeb,Date=Gallery66.Selected.Date && YPID=ViewYPSelect_10.Selected.YPID,MentalHealth) & ", " & LookUp(CriminalJusticeWeb,Date=Gallery66.Selected.Date && YPID=ViewYPSelect_10.Selected.YPID,FriendsCommunity) & ", " & LookUp(CriminalJusticeWeb,Date=Gallery66.Selected.Date && YPID=ViewYPSelect_10.Selected.YPID,RelationshipsFamily) & ", " & LookUp(CriminalJusticeWeb,Date=Gallery66.Selected.Date && YPID=ViewYPSelect_10.Selected.YPID,DrugsAlcohol) & ", " & LookUp(CriminalJusticeWeb,Date=Gallery66.Selected.Date && YPID=ViewYPSelect_10.Selected.YPID,ManagingFeelings) & ", " & LookUp(CriminalJusticeWeb,Date=Gallery66.Selected.Date && YPID=ViewYPSelect_10.Selected.YPID,PositiveUseTime) & "],
        label: '" & Gallery66.Selected.Date & "',
      },
    ],
  },
    options: {
    spanGaps: false,
    elements: {
      line: {
        tension: 0.000001,
      },
    },
    scale: {
      ticks: {
        min: 0,
        max: 5,
        stepSize: 1,
      },
    }
  },
}
"
)
 
 
Thanks
Laura
Categories:
  • jpespena Profile Picture
    jpespena 264 on at
    QuickCharts Radar Chart and For All Collection
    Hi Laura,
     
    Just wanted to asked if you were able to make this work?
  • Suggested answer
    jpespena Profile Picture
    jpespena 264 on at
    QuickCharts Radar Chart and For All Collection
    Hi Laura, 
     
    I get what you mean now.
     
    You can continue on my suggestion to create a collection (colSelected) when checking the checkbox on the gallery then use this code for the Quickchart radar chart:
     
    "https://quickchart.io/chart?c=" & EncodeUrl(
        "{
      type: 'radar',
      data: {
        labels: [
          'Accommodation/Living Environment',
          'Living Skills and Self Care',
          'Mental Health and Wellbeing',
          'Friends and Community',
          'Relationships and Family',
          'Drugs and Alcohol',
          'Managing Feelings and Response',
          'Positive Use of Time',
        ],
        datasets: [
          " & Concat(
            ForAll(
                colSelected As Item,
                "{
            backgroundColor: 'rgba(255, 255, 255, 0.5)',
            borderColor: 'rgb(75, 192, 192,1)',
            data: [" & LookUp(CriminalJusticeWeb,Date=Item.Date && YPID=ViewYPSelect_10.Selected.YPID,Accomodation) & ", " & LookUp(CriminalJusticeWeb,Date=Item.Date && YPID=ViewYPSelect_10.Selected.YPID,LivingSkills) & ", " & LookUp(CriminalJusticeWeb,Date=Item.Date && YPID=ViewYPSelect_10.Selected.YPID,MentalHealth) & ", " & LookUp(CriminalJusticeWeb,Date=Item.Date && YPID=ViewYPSelect_10.Selected.YPID,FriendsCommunity) & ", " & LookUp(CriminalJusticeWeb,Date=Item.Date && YPID=ViewYPSelect_10.Selected.YPID,RelationshipsFamily) & ", " & LookUp(CriminalJusticeWeb,Date=Item.Date && YPID=ViewYPSelect_10.Selected.YPID,DrugsAlcohol) & ", " & LookUp(CriminalJusticeWeb,Date=Item.Date && YPID=ViewYPSelect_10.Selected.YPID,ManagingFeelings) & ", " & LookUp(CriminalJusticeWeb,Date=Item.Date && YPID=ViewYPSelect_10.Selected.YPID,PositiveUseTime) & "],
            label: '" & Item.Date &"',
          }"
            ),
            Value,
            ","
        ) & "
        ],
      },
        options: {
        spanGaps: false,
        elements: {
          line: {
            tension: 0.000001,
          },
        },
        scale: {
          ticks: {
            min: 0,
            max: 5,
            stepSize: 1,
          },
        }
      },
    }
    "
    )
    With this code, Concat() function will concatenate all the selected records with the properties needed for the radar chart. However, it won't give a varying colors on the chart.

    Note that I declared the colSelected collection as "Item" in the ForAll() function and I only change the requirements on the LookUp() function with "Gallery.Selected.Date" to "Item.Date", I'm not sure if "ViewYPSelect_10.Selected.YPID" is from the gallery too but if it is you can just change it to "Item.YPID" too.
     
    Hopefully this answers your question. 
  • LauraGrimes123 Profile Picture
    LauraGrimes123 58 on at
    QuickCharts Radar Chart and For All Collection
    Not really so here is the example radar chart from quick charts:
     
     
    Here is my page:
     
     
    I want the user to click the two boxes and have both sets of data on the chart as above, but I want the user to select the ones they want if there is ever more than one (but I will limit the selection to 5)
  • Suggested answer
    jpespena Profile Picture
    jpespena 264 on at
    QuickCharts Radar Chart and For All Collection
    Hi Laura, 
     
    Did you mean you want to show multiple radar chart if a user selected multiple records in the gallery?
     
    If so, you can add a checkbox on the main gallery that has a function to collect/remove record to a new collection:
     
    OnCheck:
    Collect(colSelectedRecords, ThisItem)
     
    OnUncheck:
    Remove(colSelectedRecords, ThisItem)
     
    Then create a new gallery, could be a horizontal gallery, and set its Item properties to colSelectedRecords.
     
    Then in the gallery add the image control with the Quickchart code and change the LookUp( ) function from Selected.Date to ThisItem.Date...etc.
     
     
  • LauraGrimes123 Profile Picture
    LauraGrimes123 58 on at
    QuickCharts Radar Chart and For All Collection
    Hi @jpespena
     
    The code is outputting numbers the thing I am looking to achieve is a for all output with it.
     
    I have a gallery with the records for the chart - I want the user to be able to select the ones they wish to view on the radar chart and then for the quick chart code to be able to do a for all kind of loop with the selected records - the code as it is now works for one selected records, but I am wondering has anyone been able to achieve it with multiple records?
  • jpespena Profile Picture
    jpespena 264 on at
    QuickCharts Radar Chart and For All Collection
    Hi Laura,
     
    You can try to use your LookUp functions one by one on a text label to see if it will output a number. Your Quickchart code is correct so the issue might be coming from the LookUp codes.
     
     
  • LauraGrimes123 Profile Picture
    LauraGrimes123 58 on at
    QuickCharts Radar Chart and For All Collection
    @jpespena yes they output numbers
  • Suggested answer
    jpespena Profile Picture
    jpespena 264 on at
    QuickCharts Radar Chart and For All Collection
    Hi,
     
    Does this code
    LookUp(CriminalJusticeWeb,Date=Gallery66.Selected.Date && YPID=ViewYPSelect_10.Selected.YPID,Accomodation)
    and the rest of the LookUp functions output numbers?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,487

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,014

Leaderboard