Working with Bucket Properties and Hidden Measures
Bucket properties are user defined key/value pairs associated with a category or series level. The user can name the property and define the value using an expression.
|
Defining Bucket Properties for HTML5 Chart Hyperlinking |
Let's define a new property, called country_url, storing a link specific to the country (something like http://en.wikipedia.org/wiki/Italy and use this link in our chart measure hyperlink definition so that, when a user clicks on a column, the link of the country that the column references is opened.
| 1. | Create a new bucket property for the Country category level and use the following settings: |
| • | Property name: country_link |
| 2. | Open the configuration dialog of your measure, move to Advanced Properties, and double click the HyperlinkReference property. |
| 3. | Set the Use a bucket property value to the newly created property: country_link. |
|
Configuring Measure Properties to set the HyperlinkReference Value |
| 5. | Save the report and preview. Now, when you click a column, you should link to a Wikipedia page related to our country. |
Using bucket properties, you can create links connected to a dimension. In this case it was the Country dimension (the Country category), but the same approach can be used to create a link related to series.
To make this example a little bit more useful, and to see how we can really use hyperlink information form different dimensions, let's add an extra dimension called year, so the chart can display the number of orders placed in a specific country in a specific year. Then we can create a hyperlink that contains both the country and the year.
| 1. | Add the new dimension by creating a new series level configured as shown below: |
| • | Expression: YEAR( $F{ORDERDATE} ) |
|
Editing Series Level to Define Buckets |
Now, for each country, the chart shows the number of orders split by year.
|
Bar Chart with Order Numbers Split by Year |
Let's create a new measure to build our URL string. Measures are usually designed to hold numeric values, most of the time the result of some aggregation function (in our example we show the count of orders). But a measure can actually be anything; in our case it's a string built using an expression like the following:
| • | Hidden: true (it is very important to check the checkbox, because we are not going to display this measure, it would not make sense as it's not numeric) |
| • | Value Expression: "http://en.wikipedia.org/wiki/" + $F{SHIPCOUNTRY} + "/" + YEAR( $F{ORDERDATE}) |
| • | Value Class Name: java.lang.String |
|
Defining the URL to Open when the Measure is Clicked |
The most important things to note are:
| • | the measure is marked as hidden |
| • | the calculation type is set to Nothing |
| • | the class of the measure is String (accordingly to what the expression produces) |
The expression produces a String that represent a URL with a reference to both the country and the year of the order.
Now, let's use this measure.
| 2. | Open the # of orders measure to edit the hyperlinkReference and set the measure we just created as the value. |
|
Editing the hyperlinkReference to use a Measure Value |
Now, each column, slice, bar, and column section in the stacked column chart points to the country and year the object is representing.
Recommended Comments
There are no comments to display.