I. Overview
Sometimes we want to select parameters according to the drop-down box, and then only display the data of the corresponding map. For example, if Fujian Province is selected, the map of Fujian Province will be highlighted at the bottom, as shown in the following figure:
II. Examples
1. Data preparation
Create a new report, add a dataset ds1, and the SQL statement is select * from MapEN to record the sales data of each province and city in China, as shown in the figure below:
2. Insert chart
Take the cell chart as an example, merge a cell, insert the Area map, and select Mapbox for the GIS layer, as shown in the following figure:
3. Binding chart data
Bind the chart data, and the detailed settings are as follows:
4. Parameter setting
1) At this time, we want to select the corresponding province through the drop-down box, and display the map of the corresponding province. Click Template > Template Parameter to create a new parameter $Province, as shown in the following figure:
2) Add the parameter to the parameter pane, and select the type of the province parameter control as the drop-down box, as shown in the following figure:
3) Select the chart, select the chart property sheet - type in the chart property sheet on the right, and select the newly added Province under the template parameters for the map boundary, as shown in the following figure:
4) The corresponding value of the parameter is the file path %fr of the map file in the geographic directory _ HOME%\webapps\webroot\WEB-INF\assets\map\geographic;
For example, the "province" = "geographic/China/Jiangsu" corresponds to China/Jiangsu. JSON under the map directory;
Create a new data set DS2, and the SQL statement is SELECT distinct pid, 'geographic/World/China/'| |pid as newpid FROM MapEN where pid is not null, as shown in the figure below:
5) The data dictionary is set in the province drop-down box control. The actual value is newpid (the value corresponding to the province map in the map), and the display value is pid (the name of the province), as shown in the following figure:
5. Effect preview
Save the template and click Pagination Preview The effect is as follows:
PC terminal:
Mobile terminal:
III. Template download
Completed template, please refer to %fr_ HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Chart\Map\ MapPara.cpt
Click to download the template: