Anychart:X轴上日期的排序问题 [英] Anychart: Problems with the ordering of Dates on the X-Axis

查看:51
本文介绍了Anychart:X轴上日期的排序问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using Anychart 6 (within Oracle APEX) and I do have the following issue:

  • X轴上的日期时间(当前为字符串)
  • 两个日期部分不同的系列(请参见下面的XML)
  • 如果第一个系列缺少日期(在下面的案例中为"19.02.2014 00:00",而第二个系列具有该日期,那么该日期将作为结束日期.

是否可以先按任意系列的每个日期订购Anychart?

Is it possible to make Anychart order every date in any series first?

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

I also experimented with the "DateTime" format of Anychart, hoping it recognizes the order there, but the result remained the same.

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>

图片如下:

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

Thanks for any advice, Thomas

推荐答案

之所以会出现此错误,是因为图表会一一绘制点,并且不知道"该值,例如如果第二点在第一点之后定义,则"23.02.2014 00:00"大于值"19.02.2014 00:00".要修复它,您应该使用DateTime轴和散点图类型.如果图表与多个序列一起使用以避免重叠部分会更合理.

This error occurs because chart plots the points one by one and "don’t know" that value, e.g. "23.02.2014 00:00" is more than value "19.02.2014 00:00", if the second point is defined after the first. To fix it you should use the DateTime axes and Scatter plot type. It will be more reasonable in case when chart works with several series to avoid different overlapping.

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>

因此,结果如下:

这篇关于Anychart:X轴上日期的排序问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆