In this video, you will learn how to use charts in Centrldesk.
Charts are helpful for presenting data in a graphical format in order to obtain a quick overview. They are often used for reporting and dashboards. In this example we will create a chart and use it to display data from our database. So let's start building our application:
Steps:
- We have already created a table with four columns and we have also already createt a database table with sample data.
- First we go to the page editor by clicking on the Edit Page button in the upper right menu.
- The Page Editor opens.
- Drag and drop a pie chart element under charts to the middle of the page editor.
- Centrldesk offers many different types of charts, such as Bar Charts, Pie Charts, Line Charts or Timeline Charts.
- Select the pie chart.
- On the right side, change the Style of the chart to donut.
- On the right side, click on Labels.
- The Edit list dialog opens.
- Click on Add Item.
- Click on Item zero.
- The Edit chart category dialog opens.
- Enter "Top Management" as label.
- Confirm with save.
- Click on Add Item.
- Click on Item one.
- The Edit chart category dialog opens.
- Enter "Middle Management" as label.
- Confirm with save.
- Click on Add Item.
- Click on Item two.
- The Edit chart category dialog opens.
- Enter "Employees" as label.
- Confirm with save.
- Confirm the edit list dialog with save.
- To refresh the Pie chart later when interacting with the Add Entry button, we click on the Add Entry button and then on Edit On Click.
- The flow editor opens.
- Select the Refresh Chart block.
- On the right side, select Pie Chart.
- Close the flow editor by clicking close in the upper right corner.
- To refresh the Pie chart later when interacting with the Remove selected entry button, we click on the Remove Selected Entry button and then on Edit On Click.
- The flow editor opens.
- Select the Refresh Chart block.
- On the right side, select Pie Chart.
- Close the flow editor by clicking close in the upper right corner.
- In order to build an algorithm that calculates the number of top management, middle management and employees based on our database, we need three global variables.
- Click on the variables icon on the left side.
- The variable view is displayed.
- Click on new.
- The Variables dialog opens.
- Enter the value "counter top management" as name.
- We will need the variable later for our calculation.
- Select number as the type.
- Set zero als initial value.
- Activate the two options Input and Output.
- Confirm with ok.
- Click on new.
- The Variables dialog opens.
- Enter the value "counter middle management" as name.
- We will need the variable later for our calculation.
- Select number as the type.
- Set zero als initial value.
- Activate the two options Input and Output.
- Confirm with ok.
- Click on new.
- The Variables dialog opens.
- Enter the value "counter employees" as name.
- We will need the variable later for our calculation.
- Select number as the type.
- Set zero als initial value.
- Activate the two options Input and Output.
- Confirm with ok.
- Select the pie chart.
- On the right side, under Actions, click Edit on load.
- The flow editor opens.
- Drag and drop the Database element under App Components to the middle of the flow editor.
- The use database dialog opens.
- Select Get all rows of Employees.
- Confirm with ok.
- Drag and drop the For Each element under General to the middle of the flow editor.
- Drag and drop the Logic element under General to the middle of the flow editor.
- Connect the output of the Get all rows of Employees block to the input of the For Each block.
- Connect the output of the For Each block to the input of the Logic block.
- Select the for each block.
- On the right side, select Object als Item Type.
- Select employees as object type.
- Click on list.
- Select Custom als list.
- The logic editor opens.
- Drag and drop the Rows of employees element under Data from previous blocks to the middle of the logic editor.
- Drag and drop the List element under Libraries to the middle of the logic editor.
- Select Convert List Items.
- Confirm with ok.
- Click on Item Type.
- Select data row.
- Click on table.
- Select Employees.
- Click on result type.
- Select Object.
- Clock on object type.
- Select Employees.
- Confirm with ok.
- Connect the output of the Rows of employees block to the input of the Convert list Items block.
- Connect the output of the Convert List Items block to the input of the List block.
- Select the Convert List items block.
- Click on edit logic.
- The logic editor opens.
- Drag and drop the Data Row element under Libraries to the middle of the logic editor.
- The data row dialog opens.
- Select Split Data Row.
- Confirm with ok.
- Connect the output of the item block to the input of the Split Data Row block.
- Connect the content output of the Split Data Row block to the input of the Result block.
- Navigate back using the Back Button in the upper left corner.
- Close the Logic editor by clicking close in the upper right corner.
- Select the for each block.
- Now we need to add logic for our calculation.
- We'll leave the Logic configuration uncommented for a moment, as there are a lot of different steps involved here, but they are easy to understand when watching.
- The logic checks the hierarchy level of the respective employee and counts up the corresponding counter by one.
- Now we have finished the configuration of the Logic.
- Navigate back using the Back Button in the upper left corner.
- Select the logic block.
- Click on edit logic.
- The logic editor opens.
- Now we have to pass the calculated values as data for the Pie chart.
- Drag and drop the counter employees element under Variables to the middle of the flow editor.
- The Variable dialog opens.
- Select get variable.
- Confirm with ok.
- Drag and drop the counter middle management element under Variables to the middle of the flow editor.
- The Variable dialog opens.
- Select get variable.
- Confirm with ok.
- Drag and drop the counter top management element under Variables to the middle of the flow editor.
- The Variable dialog opens.
- Select get variable.
- Confirm with ok.
- Drag and drop the List element under Libraries to the middle of the flow editor.
- The list dialog opens.
- Select Create List.
- Confirm with ok.
- Select Number as Item Type.
- Confirm with ok.
- Drag and drop the System Object element under Libraries to the middle of the flow editor.
- The System object dialog opens.
- Select Create chart data series numeric.
- Confirm with ok.
- Drag and drop the Pie Chart element under Scope to the middle of the flow editor.
- Now the outputs of the blocks must be connected to the corresponding inputs of the blocks.
- The preview values help the user to connect the database values to the table columns.
- Close the Logic editor by clicking close in the upper right corner.
- Close the Flow editor by clicking close in the upper right corner.
- Close the Page Editor by clicking close in the upper left corner.
- Now we can try our application with the pie chart.
- We can add new entries and see how the Pie Chart updates.
- We can delete existing entries and see how the Pie Chart updates.