Anychart XML: How to set Marker settings per style?

1.2k views Asked by At



I would like to set marker settings for each style. I want to display markers for "style1" and I don't want display them for "style2".

This is my current XML with example data:

<?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>

(Note: I removed some details between the "axes" and the "legend" tag, to make the code-part smaller)
Here is a sample to set markers for a style: http://anychart.com/products/anychart/docs/users-guide/Samples/sample-simple-style-for-line-chart.html#xml-code
In my chart it displays markers for every series, no matter what style. (or no markers at all if I put this "marker_settings enabled="False"" within the "line_series style="style1""-tag).
Can anyone help with this?

Thanks in advance,
Thomas

1

There are 1 answers

2
AnyChart Support On BEST ANSWER

For this purpose, you should configure the special marker style in "marker_style" node and apply it to your first series:

<?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>