Oracle APEX - 同一图表中的多行样式(AnyChart但任何图表服务都可以使用)

时间:2012-12-04 21:48:54

标签: oracle-apex anychart

我目前正在使用Oracle Apex 4.1开发一个图表(使用默认的AnyChart插件),该图表包含多个系列,其中包含来自SQL查询的动态填充数据。虽然我可以轻松更改每个系列的线条颜色,但我还必须区分具有不同线条样式的线条(例如一个实线,一个虚线,一个带有钻石标记的虚线等)。据我所知并尝试使用AnyChart图表的自定义XML功能,我似乎无法为每个系列设置线条样式。

1)有没有人通过操纵APEX构建器页面的CustomXML部分来解决如何为每个系列设置线条样式?我没有看到拆分#DATA#替换屏幕的方法。

2)有没有人知道我可以将其他解决方案纳入APEX页面以实现我的目标?我不以任何方式依附于AnyChart。

感谢您的帮助。以下是我正在寻找的解决方案的谷歌图像搜索。

http://www.google.com/imgres?um=1&hl=en&sa=N&tbo=d&biw=1440&bih=799&tbm=isch&tbnid=gel5t-WrO7YnQM:&imgrefurl=http://www.swiftchart.com/example_1.htm&docid=cL4I17cL558p_M&imgurl=http://www.swiftchart.com/line_ex5.png&w=400&h=300&ei=JW6-UO_4C6H62gWK54DoAw&zoom=1&iact=hc&vpx=4&vpy=494&dur=29&hovh=194&hovw=259&tx=79&ty=185&sig=100543309725245412492&page=1&tbnh=139&tbnw=189&start=0&ndsp=26&ved=1t:429,r:20,s:0,i:152

1 个答案:

答案 0 :(得分:3)

只为那些寻求相同问题答案的人。

AnyChart允许对图表元素应用不同的样式。要执行OP所需的操作,您需要在Custom XML中定义样式并将它们分配给系列。例如,这是XML:

<?xml version="1.0" encoding="UTF-8"?>
<anychart>
  <charts>
    <chart plot_type="CategorizedVertical">

      <styles>
        <line_style name="style1">
          <line enabled="True" thickness="4" color="Rgb(86,86,26)" />
          <effects>
            <bevel enabled="true" highlight_opacity="0.4" shadow_opacity="0.4" distance="2" />
            <drop_shadow enabled="true" opacity="0.3" />
          </effects>
          <states>
            <hover>
              <border color="DarkRed" thickness="6" />
            </hover>
          </states>
        </line_style>
        <line_style name="style2" parent="style1">
          <line color="Rgb(180,180,255)" />
        </line_style>
        <line_style name="style3" parent="style1">
          <line color="Rgb(255,170,170)" dashed="True" dash_length="5" space_length="5" />
        </line_style>
      </styles>

      <data_plot_settings default_series_type="Line">
        <line_series>
          <marker_settings enabled="false" />
        </line_series>
      </data_plot_settings>

      <!--#DATA#-->
      &PAGE_ITEM_WITH_CHART_DATA.

      <chart_settings>
        <title enabled="false" />
        <axes>
          <y_axis>
            <title>
              <text>Salary</text>
            </title>
          </y_axis>
          <x_axis>
            <title>
              <text>Month</text>
            </title>
          </x_axis>
        </axes>
      </chart_settings>
    </chart>
  </charts>
</anychart>

隐藏的PAGE_ITEM_WITH_CHART_DATA项应包含所有图表数据系列。 styles元素定义了与图表部分一起使用的不同样式。我们可以将其中一个分配给整个系列,如下一个:

<data>
  <series name="2003 Sales" style="style1">
    <point name="January" y="12000" />
    <point name="February" y="15000" />
    <point name="March" y="16000" />
    <point name="April" y="15000" />
    <point name="May" y="14000" />
  </series>
  ...
</data>

或者我们可以只为一个点指定一个样式:

<data>
  ...
  <series name="2004 Sales" style="style2">
    <point name="January" y="10000" />
    <point name="February" y="12000" />
    <point name="March" y="18000" style="style3" />
    <point name="April" y="11000" />
    <point name="May" y="9000" />
  </series>    
<data>

您可以找到包含XML代码here的示例。