使用FusionCharts Free for axis在图表中向下钻取

时间:2010-08-26 16:36:37

标签: fusioncharts

我有以下输入xml文件:

    <Company >
    <shareprice>
        <timeStamp> 12:00:00.01</timeStamp>
        <Price>  25.02</Price>
    </shareprice>

    <shareprice>
        <timeStamp> 12:00:00.02</timeStamp>
        <Price>  15</Price>
    </shareprice>

    <shareprice>
        <timeStamp> 12:00:01.025</timeStamp>
        <Price>  15.02</Price>
    </shareprice>

    <shareprice>
        <timeStamp> 12:00:01.031</timeStamp>
        <Price>  18.25</Price>
    </shareprice>

    <shareprice>
        <timeStamp> 12:00:01.039</timeStamp>
        <Price>  18.54</Price>
    </shareprice>

    <shareprice>
        <timeStamp> 12:00:01.050</timeStamp>
        <Price> 16.52</Price>
    </shareprice>

    <shareprice>
        <timeStamp> 12:00:02.01</timeStamp>
        <Price>  17.50</Price>
    </shareprice>

    <shareprice>
        <timeStamp> 12:00:03.01</timeStamp>
        <Price>  25.02</Price>
    </shareprice>

    <shareprice>
        <timeStamp> 12:00:05.02</timeStamp>
        <Price>  30</Price>
    </shareprice>

    <shareprice>
        <timeStamp> 12:00:11.025</timeStamp>
        <Price>  32.25</Price>
    </shareprice>

    <shareprice>
        <timeStamp> 12:00:12.031</timeStamp>
        <Price>  26.05</Price>
    </shareprice>

    <shareprice>
        <timeStamp> 12:00:15.039</timeStamp>
        <Price>  18.54</Price>
    </shareprice>

    <shareprice>
        <timeStamp> 12:00:19.050</timeStamp>
        <Price> 16.52</Price>
    </shareprice>

    <shareprice>
        <timeStamp> 12:01:02.01</timeStamp>
        <Price>  17.50</Price>
    </shareprice>
</Company>

我在R中执行一些分析并生成两个XML文件。第一个输出文件采用FusionChart Free Chart的格式:

<graph caption="Share Data Wave" subcaption="For Person's Name" xAxisName="Time"  yAxisMinValue="-0.025" yAxisName="Voltage" decimalPrecision="5" formatNumberScale="0" numberPrefix="" showNames="1" showValues="0" showAlternateHGridColor="1" AlternateHGridColor="ff5904" divLineColor="ff5904" divLineAlpha="20" alternateHGridAlpha="5">
    <set name="2010-08-26 12:00:21.040" value="25.020000" hoverText = "The difference  from last value: 0" ></set>
    <set name="2010-08-26 12:01:02.531" value="15.000000" hoverText = "The difference from last value: -10.02" ></set>
     <set name="2010-08-26 12:02:02.212" value="15.020000" hoverText = "The difference from last value: 0.0199999999999996" ></set>
    <set name="2010-08-26 12:02:09.426" value="18.250000" hoverText = "The difference from last value: 3.23" ></set>
     <set name="2010-08-26 12:02:20.364" value="18.540000" hoverText = "The difference from last value: 0.289999999999999" ></set>
     <set name="2010-08-26 12:02:58.058" value="16.520000" hoverText = "The difference from last value: -2.02" ></set>
     <set name="2010-08-26 12:03:10.262" value="17.500000" hoverText = "The difference from last value: 0.98" ></set>
     <set name="2010-08-26 12:03:13.085" value="25.020000" hoverText = "The difference from last value: 7.52" ></set>
    <set name="2010-08-26 12:04:07.601" value="30.000000" hoverText = "The difference from last value: 4.98" ></set>
     <set name="2010-08-26 12:04:57.355" value="32.250000" hoverText = "The difference from last value: 2.25" ></set>
     <set name="2010-08-26 12:05:07.259" value="26.050000" hoverText = "The difference from last value: -6.2" ></set>
     <set name="2010-08-26 12:05:15.503" value="18.540000" hoverText = "The difference from last value: -7.51" ></set>
     <set name="2010-08-26 12:06:06.538" value="16.520000" hoverText = "The difference from last value: -2.02" ></set>
     <set name="2010-08-26 12:06:49.746" value="17.500000" hoverText = "The difference from last value: 0.98" ></set>
</graph>

我的问题是在查看完整图表后,用户只希望在不同时间间看到数据。在上面的格式中,它将是名称标签。如何编辑xml文件以仅显示请求的数据点。可以使用PHP表单(或类似的东西)来完成吗?

1 个答案:

答案 0 :(得分:0)

是的,这很有可能使用PHP。如果您希望编辑您所显示的XML并按照所选时间范围保留一些元素,请按照以下步骤操作:

步骤可以是:

  1. 使用表单元素选择时间范围。

  2. 根据范围,使用PHP XML解析器选择属于该范围的数据

  3. 生成特定于FusionCharts的XML

    1. 使用表单元素选择时间范围。

    2. 解析创建的FusionCharts特定XML,以删除不属于范围的集合节点的名称属性的所有值

    3. 使用此最终XML生成图表。

    4. 我可以在这里为您提供一个小的PHP示例,以便您可以使用它。