amchartsiccube-reporting

IcCube reporting V8 : How to display amchart's widget's legend in an external DIV?


Using IcCube V7, we were able to display the legend of an AmChart widget in an external DIV. Very useful for example to show only one common legend for multiple charts with same legend items.

We had to create a html widget to create the div :

<div style="height: 100%; position: absolute; width: 100%; overflow-y: auto!important; overflow-x: hidden;">
    <div id="MyLegend"><br /></div>
</div>

Then refer to this DIV in the widget in : Data render > Legend > General settings > Div Id

Is there a way to do this using new reporting V8?


Solution

  • It's not possible to show the chart's legend in an external div. However, you can add a checkbox widget and set its colors in chart > item > color & selection color. This way, it looks like a legend.

    checkbox-legend

    To make sure that the colors in the chart and in the checkbox widget are always the same, you can use a categorical color transformation on the rank of the member. For that, use the following MDX and select the rank column in the categorical color transformation:

    -- For the checkbox widget
    with 
    MEMBER [Measures].[rank] as rank([Geography].[Geography].currentMember,[Geography].[Geography].[Continent].allMembers)
    SELECT
       [Measures].[rank] on 0
       [Geography].[Geography].[Continent].allMembers ON "MdxBuilderFilterItems"
    FROM [Sales]
    
    -- For the donut chart
    // BUILDER GENERATED 
    WITH
       MEMBER [Measures].[rank] as rank([Geography].[Geography].currentMember,[Geography].[Geography].[Continent].allMembers)
    SELECT
       {[Measures].[#Articles],[Measures].[rank]} ON "value"
       [Geography].[Geography].[Continent].allMembers ON "category"
    FROM [Sales]
    FILTERBY @{continent!∅}