Creating Interactive Charts with Geopublisher 1.4
The Geopublisher 1.4 software allows the creation and publication of multimedia atlases. It has been developed for users like scientists, consultants and institutions that want to communicate their research results to the general public. The primary aim is to deliver a software that reduces the technical obstacles in publishing geo-data to a minimum. Your final product will be a user-friendly atlas which can easily be used by people who are not familiar with GIS.
Besides the possibility of publishing maps with custom styles, labels or HTML as already introduced in former blog entries, Geopublisher 1.4 includes a new charting module.
The charting module enables you to create charts based on the attributes of your geo-datasets. These charts are interactively linked with your maps - for example: if you select a point in a scatter plot, the related geo-object will also be selected in your map and the attribute table. Of course this auto-selection works vice-versa, too.

Currently Geopublisher 1.4 supports two different chart types: bar-charts and scatter plots. More types will follow (Note: If you need any other chart type, feel free to contact Wikisquare and order an extension of Geopublisher.).
About this tutorial
This tutorial will show you how to design bar charts and scatter plots in Geopublisher and how to publish them as a part of you interactive atlas. This tutorial is based on version 1.4 of Geopublisher, which has been officially released as stable on March 10th.
You may join our tutorial session and reproduce all the steps yourself. We offer you to do download the chart demo atlas, which gives you all the data we created the examples with.
Note: As Geopublisher is fully platform independent, you may follow this tutorial on any Windows, Apple or Linux computer.
Download the chart demo atlas and open it in Geopublisher:
Note: You may skip to the next section if you don't want to reproduce the steps shown here.
If you would like to reproduce this tutorial by yourself, you can download a working copy of the example atlas as a ZIP file. The example atlas contains two datasets and a few predefined charts. It can be used as a starting point to create your own charts. You can also add your own datasets to the atlas and create charts based on them.
Note: A working copy of a Geopublisher atlas is a version that you can open in Geopublisher and edit - like a .doc file in wordprocessing. Once the atlas is exported and delivered to your target group, it can not be changed anymore - like a PDF compared to a .doc file.
1. Get chart demo atlas working copy
Download the chart demo atlas here. Extract the ChartDemoAtlas.zip contents to a local folder, for example to Desktop\ChartDemoAtlas. (If you are a windows user, and you don't know hot to open a ZIP file, get 7zip or consider switching to Ubuntu Linux).
2. Start Geopublisher:
Start Geopublisher 1.4 by clicking the green start button. Some JavaWebStart dialogs will appear and you will be asked to trust the Geopublisher application to let it run on your computer. If starting Geopublisher via JavaWebStart is not working on your system, please select another method from the download page.
3. Open demo atlas:
When Geopublisher has started, open the uncompressed demo atlas by choosing Load an atlas from the File menu (or by pressing F3). Browse to the ChartDemoAtlas folder where you uncompressed the demo atlas and select the atlas.gpa file (Note: .gpa stands for GeoPublisherAtlas).

Geopublisher will open the atlas and you will see the default tripartite overview of the chart demo atlas. We see one layer and one PDF in the datapool; one thematic map in the list of maps and both linked to the menu of the demo atlas. The layer world socio-economic data has been created with Quantum-GIS based on freely availabale data from GeoCommons Finder.

Now double click on the "The digital divide" map in the thematic maps area to open it in Geopublisher's MapComposer (The MapComposer component in Geopublisher allows you to create thematic, interactive and contextualized maps based on the entries in the datapool.). A new window opens and shows an editable view of the map. In the exported atlas, the map would look similar, but with fewer options to manipulate it.

You now see the map "The digital divide". It shows the global distribution of internet bandwidth per capita. Next click the "Legend" tab on the left to access the interactive legend.
Create charts based on global data
In the MapComposer window, you see which layers were used to create your map. The interactive legend always lists all layers, but this map demo map only consists of one layer.
A look at the attributes
Before we start to create charts, let's have a quick look at the attribute table, so that you know what data is available for our tutorial. Click the layer tool menu (ICON) of the world socio-economic data layer and choose attribute table and the attribute table for this layer opens.

The attribute table shows all the attributes that are available for each country. As you can see, out first column contains information on the internet bandwidth available in every country. The third column shows the geographic region the country is part of.
Idea: Let's create a bar chart, that compares the bandwidth availability of the world's regions!
A bar chart comparing regions

With Geopublisher it is easy to create a bar-chart comparing regions and publish it as an interactive part of your atlas. First click the layer tool menu of the world socio-economic data layer and choose Manage charts... .
The chart wizard appears. It will guide you through the basic steps needed to create a chart. In the first step you may choose a chart type. Select bar chart and click Next.

In the second step you may choose the attributes that shall be used for the bar chart. You may use up to four variables (which would create three bars for every region). For our simple example we just choose two attributes: The first attribute defines the categories we want to see bars for. We select the Region attribute. For the second attribute we select the Bandwidth attribute.

In the last step you are asked to enter a title and a description for your chart. This information could be entered in multiple languages, if this atlas was configured to support more than one language, but for our basic example we stick with "just" English.

After you pressed Finish, the chart is created and appears in the list of available charts. Also a chart design dialog will open, that allows to design the layout and appearance of the chart in detail. This first view of the chart we get, is a only a generic proposal. Before we publish the chart to the atlas users, we want to make it more beautiful and "smarter".

At first, enable the Automatic preview checkbox. Now any change will automatically be applied to the preview in the upper part. Unless you have very large or slow (=from the Internet) data, you should always enable the automatic preview.
Configuring axis labelling
In the next step, lets correct the domain axis labelling. The labels are obviously too long and thus the texts overwrite each other. They should be positioned in a different angle. To change the label angle select the domain axis tab.
Moving the slider between 0° and 90° automatically changes the label position in the preview. Tune the slider until you are satisfied with the amount of space the labels take.
Next let's go the bars tab and configure their color. When creating a new chart, the color is selected by random. The bars tab allows you to define the color and other features.

Attribute aggregation
Have you wondered, how the height of these bars is calculated? As you have seen in the attribute table, many countries fall into the same region. Hence their attribute values have to be aggregated using a function you may define in Geopublisher. The following list gives a short explanation of all available aggregation methods in Geopublisher 1.4:
- Count: The value (height) of the bar is the count of countries falling into this category. The actual value of the attribute is ignored.
- Sum: The bar value (height) is equal to the sum of the attribute values of all countries in each category.
- Absolute Sum: The bar value (height) equals the sum of the absolute attribute value of all countries in a category.
- Average: Calculates the arithmetic average of the attribute values in a category.
- Weighted Average: Calculates the weighted arithmetic average of the attribute values in a category. A second weight attribute has to be selected. See wikipedia for mathematic explanation.
- Median: The bar represents the value (height) of the median value in a category. See wikipedia for mathematic explanation.
- Minimum: The bar represents the value (height) of the smallest value in a category.
- Maximum: The bar represents the value (height) of the biggest value in a category.
- Variance and Standard Deviation: Variance and Standard Deviation are statistical values describing how (in-)homogeneous the values in a category are.
For our example of Internet availability in the world regions we have chosen to select the weighted average aggregation method. How does weighted average aggregation work and when should it be used?
Weighted average attribute aggregation
To explain the difference between weighted and unweighted average, let's image the following table of imaginary values:
| Country | Region | Population | Yearly beer consumption [l/per capita] |
| Germany | A | 1000 | 50 |
| Luxembourg | A | 100 | 100 |
| France | A | 1000 | 20 |
If unweighted (=normal) average aggregation is selected, the result for region A would be calculated as follows:
mean = ( 1stValue + 2ndValue + 3rdValue ) / number of values
= ( 50 + 100 + 20 ) / 3
= 56,67 l/per capita
This result is not the average beer consumption of region A per capita. The country of Luxembourg is small in comparison to Germany and France and the high beer consumption of its people is overrated in the formula above. To calculate the correct average beer consumption per capita for region A, the population of each country has to be taken into account.
weighted mean = ( 1stValue*1stWeight + 2ndValue*2ndWeight + 3rdValue*3rdWeight ) / sum of weights
= 50*1000 + 100*100 + 20*1000 / 2100
= 80000 / 2100
= 38,1 l/per capita
The result of the weighted average is the correct yearly beer consumption for all 2100 people in region A. Weighted average should always be used if the attribute values are per capita, per area or have a reference basis in general.
For our example of Internet availability in the world regions, the following settings should be applied in Geopublisher, because the bandwidth attribute data is measured in MBps per capita.

These settings made, you have succsessfully created your first bar chart. Please note, that Geopublisher has automatically created the axis descriptions for you based on meta-data entered for the layer. If you don't like Geopublishers automatic labels, you can always adapt the axis descriptions manually. The resulting bar chart looks like this.

Interactivity between maps and charts
Geopublisher 1.4 has a feature called selection synchronization. It means, that whenever a chart or an attribute table are visible for a map, the user may make selections in each one of them, and Geopublisher automatically synchronizes the selections. For example this allows you to select outlier points in a chart, and see which country/geometry corresponds to this datapoint.
Note: For aggregated bar charts, this functionality is not yet implemented. But for unaggregated bar charts (where one bar corresponds to exactly one geometry) selection synchronization works.
The following two screenshots show the selection synchronization between a scatter plot and a map. In the first image, a selection is made in the scatter plot, and the corresponding countries are highlighted in the map:

The second screenshot shows how a selection is made in the map around South America, and the corresponding data points are highlighted in the chart.

Conclusion
This tutorial showed you how a bar chart based on automatically aggregated attribute values can be created. We did not go into detail about how to create a scatter plot, but the procedure is mainly the same.
Charts are bound to the layer where their data comes from. If a layer is used in multiple maps, Geopublisher allows you to define exactly which charts are available in which maps.
Of course, Geopublisher charts - as all parts of a Geopublisher atlas - can also be translated into multiple languages.
If you have any questions or ideas about the chart functionality, please give us feedback on the AtlasStyler and Geopublisher user mailinglist.
Happy charting!

















Kommentar hinzufügen