Hello,
I would like to share with you a new component developed in the SDK Community Package.
It allows you to use an image and create interactive areas on it in Design studio. You can fully customize it, link it to datasource data and show tooltips.
Use cases:
You can download a test app created with DS 1.6 SP2 P1. If you want to open it with an older version, you'll have to edit xml and .properties file.
I hope this component will be useful for you, and don't hesitate to ask questions in the comment section !
PS: Please raise issues or requests for improvements on the dedicated GitHub section instead of SCN comments.
I created this component because of the lack of really custom map related to non-geographic data, and wanted to streamline the process making those.
The component is based on the Mapster JQuery library and should be well supported on mobile devices.
Here's an example with store areas are coloured depending on the net amounts:
The selection of one or more areas triggers this event in Design studio, and you can get the selected areas using the method .getSelectedAreas(), which gives you a string in CSV format: A1,A2,A3 ...
You can directly pass this parameter to the .setFilter() method on another datasource if you split the table on the comma.
This event is triggers whenever the user hovers an area with its mouse and you can get the area code by using the method .getHighlightedArea().
When the component gets updated, this event is triggered.
It not mandatory to bind data, but you have the option to do so. The Dynamic colors can be used in this case.
Just select a datasource, avoid to filter the data list on measure if possible.
You should select which measure should be used in "Reference Measure Selection" if you want to associate the areas with the dynamic colors. The first one is used by default.
Those are mandatory.
You could generate this code directly in the application instead of having to create them manually if you have them stored somewhere, in a datasource or a css/text file on the BI platform.
It's quite easy to define the areas, you just need to take your image to Image Map Tool - On-line Image Map Creator - HTML & CSS | Image-Maps.com and start mapping !
First, upload the image on the website and start mapping by right clicking on the image. You can create either Rectangles, circles or Polygones (any shape).
In the options, you just need to associate an ID. Other settings are more than optionals, and clic Save
You can create as many areas you want on the image. Don't bother on the style, it will be handled by the component at the runtime.re
The last steps are:
1 - Get the code
Open the HTML code tab and go down to HTML Image Map Code
2 - Copy paste and clean it:
Now you can take this html code and paste it in the "Associated Map" property in the component.
You should now see the areas on the image in Design studio !
Several sub tabs enables to customize even further the areas.
This is where you set the different display properties for all the areas. Note the fill color could be overwritten by the dynamic colors if activated.
Both pane features the same properties.
Selected is applied to all the selected areas whereas Highlighted is for hovered areas.
Those properties are used only if you checked "Activate Special properties" checkbox.
You can also define specific properties for each areas
The key needs to match the one from the "Map key" attribute of the areas. If a property is empty, it will not be used.
The tooltip content can be either static HTML code, or a template with the JS Render format. You'll need to chose "Evaluate as Template" to get it rendered correctly.
This tab is used to set up the behaviour of the map
This feature is only use in combination with data binding. When you have selected a key figure, the component will use the minimum and maximum value of it to change the color of each area (Quantile method) according to the selected color palette.
Some palettes are proposed in the Options button.
The first color is for the minimum, and the last for the maximum.
In this tab, you can choose to display the tooltips, but not only. You can also consider the specific tooltip (see Area properties -> Specific -> tooltip) as a template, or override it with a custom template.
Templates are rendered using JsRender and you can access a lot of information from your datasource, as well create calculations and implement logics; If, For etc are supported, which makes it very powerful.
Each field can be rendered using this syntax: {{:name}}.
The data fields accessibles are matching the pattern detailed below:
<FIELD_TYPE> can be either:
Here's an exemple of the data accessible in the tooltip template:
And an exemple of dynamic rendering using the JS render Tooltip template, with some local calculation:
Tooltip code | Header 3 |
---|---|
|
For instance, I am able to calculate the % of contribution of each category with:
{{* vCatPC = data.MES_A83Y2FPNS2H7DCEHG43W741JM_RAW / data.total.MES_A83Y2FPNS2H7DCEHG43W741JM_RAW * 100; }}
{{*: vCatPC.toFixed(2);}}%
Those tags is interpreted as raw javascript and I can calculate and determine nearly everything using the data as hand, my current net amount and the total net amount.
Same applies for the list of material:
First, I store the total of the category in a javascript variable vTotal:
{{* vTotal = data.MES_A83Y2FPNS2H7DCEHG43W741JM_RAW; }}
Secondly, I generate a table and loop on each material:
<table class="tableContentTooltip">
{{for lines}}
And for each, I calculate the % of contribution and round it to 2 decimals:
{{* curPC = data.MES_A83Y2FPNS2H7DCEHG43W741JM_RAW / vTotal * 100; }}
{{*: curPC.toFixed(2);}}%
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
50 | |
5 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
2 |