Anychart XML:如何设置每个样式的标记设置?

时间:2014-11-26 08:17:11

标签: xml anychart



我想为每种风格设置标记设置。我想显示" style1"而且我不希望将它们展示给" style2"。

这是我当前带有示例数据的XML:

<?xml version = "1.0" encoding="utf-8" standalone = "yes"?>
<anychart>
  <settings>
    <animation enabled="false"/>
    <no_data show_waiting_animation="False">
      <label>
        <text></text>
        <font family="Verdana" bold="yes" size="10"/>
      </label>
    </no_data>
  </settings>
  <margin left="0" top="" right="0" bottom="0" />
  <charts>
    <chart plot_type="CategorizedVertical" name="chart_1295609758644867"> 
        <styles>
            <line_style name="style1">
                <line enabled="true" thickness="5" opacity="1" />
            </line_style>
            <line_style name="style2">
                <line dashed="True" dash_length="2" space_length="5" color="red"/>
            </line_style>
        </styles>
      <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>
        <axes>
          <y_axis >
          </y_axis>
          <x_axis>
          </x_axis>
        </axes>
        <legend enabled="true" position="Right" align="Near" elements_layout="Vertical" 
        </legend>

      </chart_settings>
      <data_plot_settings enable_3d_mode="false" default_series_type="Line">
        <line_series style="style1">
          <tooltip_settings enabled="true">
            <format><![CDATA[{%Name}{enabled:False} - {%Value}{numDecimals:1,decimalSeparator:\,,thousandsSeparator:.}]]></format>
            <font family="Tahoma" size="10" color="0x000000" />
              <position anchor="Float" valign="Top" padding="10" /> 
          </tooltip_settings>
          <label_settings enabled="false" mode="Outside" multi_line_align="Center">
            <format><![CDATA[{%Value}{numDecimals:1,decimalSeparator:\,,thousandsSeparator:.}]]></format>
            <background enabled="false"/>
            <font family="Arial" size="10" color="0x000000" />
          </label_settings>
          <line_style>
                       <line enabled="true" thickness="5" opacity="1" />
          </line_style>
          <marker_settings enabled="True" >
            <marker type="Circle" />
          </marker_settings>
        </line_series>
        <line_series style="style2">
            <marker_settings enabled="False" />
        </line_series>
      </data_plot_settings>
      <data>
        <series name="A" style="style1">
            <point name="01.01.2014" y="1"/>
            <point name="02.01.2014" y="1"/>
            <point name="03.01.2014" y="1"/>
        </series>
        <series name="B" style="style2">
            <point name="01.01.2014" y="2"/>
            <point name="02.01.2014" y="2"/>
            <point name="03.01.2014" y="2"/>
        </series>
      </data>
    </chart>
  </charts>
</anychart>

(注意:我删除了&#34;轴&#34;和#34;图例&#34;标签之间的一些细节,以使代码部分更小)
这是一个要设置的示例样式的标记:http://anychart.com/products/anychart/docs/users-guide/Samples/sample-simple-style-for-line-chart.html#xml-code
在我的图表中,无论采用何种样式,它都会显示每个系列的标记。 (或者如果我把这个&#34; marker_settings启用=&#34; False&#34;&#34;&#34; line_series style =&#34; style1&#34;&#34; -tag)。
任何人都可以帮忙吗?

先谢谢,托马斯

1 个答案:

答案 0 :(得分:1)

为此,您应该在&#34; marker_style&#34;中配置特殊标记样式。节点并将其应用于您的第一个系列:

<?xml version = "1.0" encoding="utf-8" standalone = "yes"?>
<anychart>
  <settings>
    <animation enabled="false"/>
    <no_data show_waiting_animation="False">
      <label>
        <text></text>
        <font family="Verdana" bold="yes" size="10"/>
      </label>
    </no_data>
  </settings>
  <margin left="0" top="" right="0" bottom="0" />
  <charts>
    <chart plot_type="CategorizedVertical" name="chart_1295609758644867"> 
        <styles>

            <line_style name="style1">
                <line enabled="true" thickness="5" opacity="1" />
            </line_style>
            <line_style name="style2">
                <line dashed="True" dash_length="2" space_length="5" color="red"/>
            </line_style>

            <marker_style name="markerStyle1">
                <marker type="Circle" />
            </marker_style>

        </styles>

      <data_plot_settings enable_3d_mode="false" default_series_type="Line">

        <line_series style="style1">
          <tooltip_settings enabled="true">
            <format><![CDATA[{%Name}{enabled:False} - {%Value}{numDecimals:1,decimalSeparator:\,,thousandsSeparator:.}]]></format>
            <font family="Tahoma" size="10" color="0x000000" />
              <position anchor="Float" valign="Top" padding="10" /> 
          </tooltip_settings>
          <label_settings enabled="false" mode="Outside" multi_line_align="Center">
            <format><![CDATA[{%Value}{numDecimals:1,decimalSeparator:\,,thousandsSeparator:.}]]></format>
            <background enabled="false"/>
            <font family="Arial" size="10" color="0x000000" />
          </label_settings>
        </line_series>

      </data_plot_settings>
      <data>
        <series name="A" style="style1">
        <marker enabled="true" style="markerStyle1"/>
            <point name="01.01.2014" y="1"/>
            <point name="02.01.2014" y="1"/>
            <point name="03.01.2014" y="1"/>
        </series>
        <series name="B" style="style2">
        <marker enabled="false"/>
            <point name="01.01.2014" y="2"/>
            <point name="02.01.2014" y="2"/>
            <point name="03.01.2014" y="2"/>
        </series>
      </data>
    </chart>
  </charts>
</anychart>