如何在外部DIV中显示amchart的小部件图例?

huangapple go评论44阅读模式
英文:

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

问题

使用 IcCube V7,我们能够在外部 DIV 中显示 AmChart 部件的图例。例如,对于显示具有相同图例项的多个图表的公共图例非常有用。

我们需要创建一个 HTML 部件来创建这个 DIV:

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

然后在部件中引用此 DIV:
数据呈现 > 图例 > 通用设置 > DIV ID

是否有办法在新的报告 V8 中实现这一功能?

英文:

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 :

&lt;div style=&quot;height: 100%; position: absolute; width: 100%; overflow-y: auto!important; overflow-x: hidden;&quot;&gt;
    &lt;div id=&quot;MyLegend&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;

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?

答案1

得分: 2

不可能在外部div中显示图例。但是,您可以添加复选框小部件,并在图表 > 项目 > 颜色和选择颜色中设置其颜色。这样,它看起来就像一个图例。

为了确保图表中的颜色和复选框小部件中的颜色始终相同,您可以在成员的等级上使用分类颜色转换。为此,请使用以下MDX,并在分类颜色转换中选择 rank 列:

with 
MEMBER [Measures].[rank] as rank([Geography].[Geography].currentMember,[Geography].[Geography].[Continent].allMembers)
SELECT
   [Measures].[rank] on 0
   [Geography].[Geography].[Continent].allMembers ON &quot;MdxBuilderFilterItems&quot;
FROM [Sales]

-- 对于环形图
// 生成的构建器
WITH
   MEMBER [Measures].[rank] as rank([Geography].[Geography].currentMember,[Geography].[Geography].[Continent].allMembers)
SELECT
   {[Measures].[#Articles],[Measures].[rank]} ON &quot;value&quot;
   [Geography].[Geography].[Continent].allMembers ON &quot;category&quot;
FROM [Sales]
FILTERBY @{continent!∅}
英文:

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.

如何在外部DIV中显示amchart的小部件图例?

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 &quot;MdxBuilderFilterItems&quot;
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 &quot;value&quot;
   [Geography].[Geography].[Continent].allMembers ON &quot;category&quot;
FROM [Sales]
FILTERBY @{continent!∅}

huangapple
  • 本文由 发表于 2023年2月6日 18:05:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/75359856.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定