仅显示Oracle Apex / AnyChart饼图的图例

时间:2015-06-19 08:45:14

标签: xml oracle oracle-apex anychart

我目前正试图在APEX 4.26中显示固定大小饼图的仪表板,但是,他们需要有一个图例,其内容是动态的。这意味着具有更多标签的图表具有更大的图例和更小的饼图,而不是仅具有两个标签的图表。

我目前可能的解决方案是为每个图表创建两个区域,一个包含饼图,另一个只包含图例,然后我可以轻松控制这些区域的大小。

显然,我可以很容易地关闭第一个区域的传奇,但是我在另一个区域只显示传奇时遇到了一些麻烦。任何人都可以帮助我改变或删除XML吗? (我认为这是做这件事的方法)。这是我的XML:

<?xml version = "1.0" encoding="utf-8" standalone = "yes"?>  
<anychart>  
  <settings>  
    <animation enabled="true"/>  
    <no_data show_waiting_animation="False">  
      <label>  
        <text>#NO_DATA_MESSAGE#</text>  
        <font family="Verdana" bold="yes" size="10"/>  
      </label>  
    </no_data>  
  </settings>  
  <margin left="0" top="-10" right="0" bottom="0" />  
  <charts>  
    <chart plot_type="Pie" name="chart_3232705401305025">   
      <chart_settings>  
        <title enabled="False" />  
        <chart_background>  
          <fill type="Solid" color="0xffffff" opacity="0" />  
          <border enabled="false"/>  
          <corners type="Square"/>  
        </chart_background>  
        <data_plot_background>  


        </data_plot_background>  


        <legend enabled="true" position="Bottom" align="Near" elements_layout="Horizontal" ignore_auto_item="True">  
          <title enabled="False"/>  
          <icon>  
            <marker enabled="true" />  
          </icon>  
          <items>  
            <item source="Points" />  
          </items>  
          <font family="Tahoma" size="10" color="0x000000" />  
        </legend>  
        <chart_animation type="Appear" interpolation_type="Quadratic" show_mode="OneByOne"/>  
      </chart_settings>  
      <data_plot_settings enable_3d_mode="false" >  
        <pie_series style="Aqua">  
          <tooltip_settings enabled="true">  
            <format><![CDATA[{%Name}{enabled:False} - {%Value}{numDecimals:0,decimalSeparator:.,thousandsSeparator:\,}]]></format>  
            <font family="Tahoma" size="10" color="0x000000" />  
              <position anchor="Float" valign="Top" padding="10" />   
          </tooltip_settings>  
          <label_settings enabled="false"/>  
          <pie_style>  


          </pie_style>  
          <marker_settings enabled="True" >  
            <marker type="None" />  
          </marker_settings>  
          <connector color="Black" opacity="0.4"/>  
        </pie_series>  
      </data_plot_settings>  


#DATA#  
    </chart>  
  </charts>  
</anychart>  

任何指针都非常感谢!或任何明智的想法,以更容易的方式实现这一目标。

谢谢!

2 个答案:

答案 0 :(得分:1)

您可以使图表不可见,设置图例浮动并重叠整个图表,下面的示例执行此操作,您也可以在APEX中复制它。

关键设置是:

<chart_settings>
   <legend enabled="true"  position="Float" width="100%" height="100%"/>
   <title enabled="false" />
</chart_settings>    

resulting legend

完整设置:

<?xml version="1.0" encoding="UTF-8"?>
<anychart>
  <charts>
    <chart plot_type="Pie">
      <data_plot_settings>
        <pie_series apply_palettes_to="Points" radius="0">
          <tooltip_settings enabled="false"/>
          <label_settings enabled="false"/>
        </pie_series>
      </data_plot_settings>
      <chart_settings>
        <legend enabled="true"  position="Float" width="100%" height="100%"/>
        <title enabled="false" />
      </chart_settings>      
      <data>
        <series name="Year 2003">
          <point name="Department Stores" y="637166" />
          <point name="Discount Stores" y="721630" />
          <point name="Men's/Women's Specialty Stores" y="148662" />
          <point name="Juvenile Specialty Stores" y="78662" />
          <point name="All other outlets" y="90000" />
        </series>
        <series name="Year 2004">
          <point name="Department Stores" y="737166" />
          <point name="Discount Stores" y="537166" />
          <point name="Men's/Women's Specialty Stores" y="188662" />
          <point name="Juvenile Specialty Stores" y="178662" />
          <point name="All other outlets" y="89000" />
        </series>
      </data>
    </chart>
  </charts>
</anychart>

图例设置和定位在:http://6.anychart.com/products/anychart/docs/users-guide/index.html?legend-text-formatting.html

中描述

答案 1 :(得分:0)

为了更新这个问题,我想出了一个适用于一个图表的可能解决方案,并且我想在这里概述一下,以防有人看到这个并且没有答案。

我使第二个区域中的饼图尽可能小,然后使用CSS在第一个饼图上移动第二个区域,以便第二个区域中的图例正确定位在第一个饼图的下方。< / p>

然后我使用z-index将第二个区域移到第一个区域后面。这似乎有效,我只需要以某种方式隐藏来自第二个区域的“等待数据”消息。