Display Radar Charts
Overview
This article introduces how to display radar charts on Kintone's Record Detail page. Data from 5 Number fields are retrieved, and are set on a radar chart created with Chart.js . Chart.js is a JavaScript library that draws pie charts, line charts, bar graphs, and radar charts.
Sample Image
In this example, when the user navigates to the Record Detail page, a radar chart of a student's grade is displayed.
The radar chart can also be viewed through the mobile view .
Prepare the App
Create the form
Create an App named "Student Grades" with the following fields and settings.
Field Type | Field Name | Field Code (or Element ID) |
Notes |
---|---|---|---|
Text | Name | name | |
Blank space | -- | radar_space | |
Number | Language Arts | language_arts | |
Number | Math | math | |
Number | Science | science | |
Number | Social Studies | social_studies | |
Number | P.E. | pe | |
Calculated | Total | total | Set the formula as language_arts + math + science + social_studies + pe |
Calculated | Average | average | Set the formula as total/5 |
The form should look like the below screenshot.
After creating the App, add a few records inside.
Set the library
This example uses Chart.js v4.4.0. Set the following URL from the Kintone CDN into the App's JavaScript and CSS Customization settings .
Sample code
Type the following code into a text editor and save it as a JavaScript file. Upload it to the App's JavaScript and CSS Customization settings .
|
|
Attention
Caution: The order in which JavaScript and CSS are uploaded to an app matters. In this example, ensure that the Chart.js library is uploaded before the JavaScript file. You can change the order of uploads by clicking and dragging on the arrows for each item on the Upload JavaScript / CSS page.
After saving the settings and clicking on Update App, navigate to the Record Details page of a record. The number fields in the record should be displayed as a Radar chart. This can also be viewed on the mobile view.