Link Search Menu Expand Document

Create Compliance Charts - Donut

On this page, you will make the Compliance Rate donut chart shown below, on the right:
Compliance Rate donut chart

  1. On the Charts Dashboard, select “Add Chart”
    Goto "Add Chart" for creating a new Chart

  2. Set the title to “Boarding Compliance”
    Chart Title set to "Boarding Compliance"

  3. Set the Data Source to wildaid.BoardingReports How to select "wildaid.BoardingReports" as Data Source

  4. Choose a Chart type of Circular, which will the default chart subtype “Donut”: Circular Chart Type selected with default subtype "Donut"

  5. Drag “_id” to the “Arc” field, making sure that the aggregate is by “COUNT”:
    "Arc" set as "_id" with agregate set to "COUNT"

  6. To show how many boardings are compliant vs. non-compliant, let’s create a calculated field. Select “+ Add Field”:
    Select "+ Add Field" to create a calculated field

  7. Select “CALCULATED” in the upper right of the popup box, set the Field Name to “isCompliant”, and set the Value Expression to check if the boarding is compliant or not:
    { $cond: { if: {$eq: ['$inspection.summary.safetyLevel.level','Green']},
    then: "Compliant",
    else: "Non-compliant" } }
    and then select “Save Field”:
    How to create a Calculated field

  8. Drag the new isCompliant field to the Label, making sure the SORT BY menu is set to “VALUE”:
    isComplaint field dragged to Label with SORT BY VALUE

  9. Select “Customize”, toggle “Custom Color Palatte” to be on, and drag the colors to the proper ordering so that Non-compliant is red and Compliant is green:
    Customized color chart with Non-complaint colored as red and Compliant as green

  10. Select “Save and Close”

  11. On your dashboard, mouse over the chart until you see the ellipses. Select the ellipses and select “Embed Chart”: How to select an "Embed Chart"

  12. Select the “Authenticated” section, make sure “Enabled authenticated access” is set to “ON”, and set the User Specified Filters to “date” and select the green “SAVE” button:
    How to create an "Embed Chart"

  13. Copy the Chart ID:
    How to get the Chart ID of an Embed Chart

  14. Select “Close” to close the “Embed Chart” window.

  15. Paste the Chart ID into your web application’s src/config.js file under “boarding-compliance”.



Finally, the map!



Troubleshooting - Up to main build page