Anychart:X轴上日期排序的问题

时间:2015-02-05 11:39:01

标签: datetime anychart

我正在使用Anychart 6(在Oracle APEX中),我确实遇到以下问题:

  • 我的X轴上的日期时间(当前为字符串)
  • 2系列具有部分不同的日期(请参阅下面的XML)
  • 如果第一个系列缺少日期(在下面的情况下是“19.02.2014 00:00”而第二个系列有该日期,则该日期将作为结束日期。

是否可以先在任何系列中的每个日期订购Anychart?

我还尝试了Anychart的“DateTime”格式,希望它能识别那里的顺序,但结果保持不变。

XML:

<anychart>
    <settings>
        <animation enabled="false"/>
        <no_data show_waiting_animation="False">
            <label>
                <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="8" color="red"/>
                    <marker_settings enabled="False"/>
                </line_style>
                <line_style name="style3">
                    <line dashed="True" dash_length="2" space_length="8"/>
                </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>
                        <scale mode="Normal"/>
                        <title enabled="false"/>
                        <labels enabled="true" position="Outside">
                            <font family="Tahoma" size="10" color="0x000000"/>
                            <format>{%Value}{numDecimals:1,decimalSeparator:\,,thousandsSeparator:.}</format>
                        </labels>
                        <major_grid enabled="False"/>
                        <minor_grid enabled="False"/>
                    </y_axis>
                    <x_axis>
                        <scale mode="Normal"/>
                        <title>
                            <text>Date</text>
                            <font family="Tahoma" size="14" color="0x000000"/>
                        </title>
                        <labels enabled="true" rotation="45" position="Outside">
                            <font family="verdana_embed_tf" size="10" color="0x000000"/>
                            <format>{%Value}{numDecimals:1,decimalSeparator:\,,thousandsSeparator:.}</format>
                        </labels>
                        <major_grid enabled="True" interlaced="false">
                            <line color="Black"/>
                        </major_grid>
                        <minor_grid enabled="True">
                        </minor_grid>
                    </x_axis>
                </axes>
                <legend enabled="true" position="Right" align="Near" elements_layout="Vertical" ignore_auto_item="true">
                    <title enabled="False"/>
                    <items>
                        <item source="Series"/>
                    </items>
                    <font family="Arial" size="10" color="0x000000"/>
                </legend>
            </chart_settings>
            <data_plot_settings enable_3d_mode="false" default_series_type="Line">
                <line_series style="style1">
                    <tooltip_settings enabled="true">
                        <format>{%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>{%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>
                <line_series style="style3">
                    <marker_settings enabled="true"/>
                </line_series>
            </data_plot_settings>
            <data>
                <series name="A" style="style1" color="#262DB3">
                    <point name="14.02.2014 00:00" y="892"/>
                    <point name="15.02.2014 00:00" y="830"/>
                    <point name="16.02.2014 00:00" y="829"/>
                    <point name="17.02.2014 00:00" y="871"/>
                    <point name="18.02.2014 00:00" y="847"/>
                    <point name="20.02.2014 00:00" y="849"/>
                    <point name="21.02.2014 00:00" y="830"/>
                    <point name="22.02.2014 00:00" y="822"/>
                    <point name="23.02.2014 00:00" y="823"/>
                </series>
                <series name="B" style="style1" color="#2A8015">
                    <point name="15.02.2014 00:00" y="13"/>
                    <point name="16.02.2014 00:00" y="15"/>
                    <point name="17.02.2014 00:00" y="11"/>
                    <point name="18.02.2014 00:00" y="11"/>
                    <point name="19.02.2014 00:00" y="19"/>
                    <point name="20.02.2014 00:00" y="14"/>
                    <point name="21.02.2014 00:00" y="15"/>
                    <point name="22.02.2014 00:00" y="51"/>
                </series>
            </data>
        </chart>
    </charts>
</anychart>

它的样子: Picture

感谢您的任何建议, 托马斯

1 个答案:

答案 0 :(得分:1)

发生此错误是因为图表逐个绘制点并且“不知道”该值,例如如果第二个点在第一个点之后定义,则“23.02.2014 00:00”超过值“19.02.2014 00:00”。要修复它,您应该使用DateTime轴和Scatter绘图类型。如果图表与多个系列一起使用以避免不同的重叠,那将更加合理。

XML:

<anychart>
    <settings>
        <animation enabled="false"/>
        <no_data show_waiting_animation="False">
            <label>
                <text/>
                <font family="Verdana" bold="yes" size="10"/>
            </label>
        </no_data>
        <locale>
      <date_time_format>
        <format><![CDATA[%dd.%MM.%yyyy %HH:%mm]]></format>
      </date_time_format>
    </locale>
    </settings>
    <margin left="0" top="" right="0" bottom="0"/>
    <charts>
        <chart plot_type="Scatter" 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="8" color="red"/>
                    <marker_settings enabled="False"/>
                </line_style>
                <line_style name="style3">
                    <line dashed="True" dash_length="2" space_length="8"/>
                </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>
                        <scale mode="Normal"/>
                        <title enabled="false"/>
                        <labels enabled="true" position="Outside">
                            <font family="Tahoma" size="10" color="0x000000"/>
                            <format>{%Value}{numDecimals:1,decimalSeparator:\,,thousandsSeparator:.}</format>
                        </labels>
                        <major_grid enabled="False"/>
                        <minor_grid enabled="False"/>
                    </y_axis>
                    <x_axis>
                        <scale type="DateTime"/>
                        <title>
                            <text>Date</text>
                            <font family="Tahoma" size="14" color="0x000000"/>
                        </title>
                        <labels enabled="true" rotation="45" position="Outside">
                            <font family="verdana_embed_tf" size="10" color="0x000000"/>
                            <format><![CDATA[{%Value}{dateTimeFormat:%dd/%MM/%yyyy}]]></format>
                        </labels>
                        <major_grid enabled="True" interlaced="false">
                            <line color="Black"/>
                        </major_grid>
                        <minor_grid enabled="True">
                        </minor_grid>
                    </x_axis>
                </axes>
                <legend enabled="true" position="Right" align="Near" elements_layout="Vertical" ignore_auto_item="true">
                    <title enabled="False"/>
                    <items>
                        <item source="Series"/>
                    </items>
                    <font family="Arial" size="10" color="0x000000"/>
                </legend>
            </chart_settings>
            <data_plot_settings enable_3d_mode="false" default_series_type="Line">
                <line_series style="style1">
                    <tooltip_settings enabled="true">
                        <format>{%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>{%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>
                <line_series style="style3">
                    <marker_settings enabled="true"/>
                </line_series>
            </data_plot_settings>
            <data>
                <series name="A" style="style1" color="#262DB3">
                    <point x="14.02.2014 00:00" y="892"/>
                    <point x="15.02.2014 00:00" y="830"/>
                    <point x="16.02.2014 00:00" y="829"/>
                    <point x="17.02.2014 00:00" y="871"/>
                    <point x="18.02.2014 00:00" y="847"/>
                    <point x="20.02.2014 00:00" y="849"/>
                    <point x="21.02.2014 00:00" y="830"/>
                    <point x="22.02.2014 00:00" y="822"/>
                    <point x="23.02.2014 00:00" y="823"/>
                </series>
                <series name="B" style="style1" color="#2A8015">
                    <point x="15.02.2014 00:00" y="13"/>
                    <point x="16.02.2014 00:00" y="15"/>
                    <point x="17.02.2014 00:00" y="11"/>
                    <point x="18.02.2014 00:00" y="11"/>
                    <point x="19.02.2014 00:00" y="19"/>
                    <point x="20.02.2014 00:00" y="14"/>
                    <point x="21.02.2014 00:00" y="15"/>
                    <point x="22.02.2014 00:00" y="51"/>
                </series>
            </data>
        </chart>
    </charts>
</anychart>

所以这是结果: enter image description here