将动态值传递到 xml 文件 -flex fusion 图表

发布于 2024-10-23 23:01:46 字数 1508 浏览 1 评论 0原文

<?xml version="1.0" encoding="utf-8"?>
<s:BorderContainer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark" 
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                  xmlns:components="com.fusionwidgets.components.*">

    <components:FusionWidgets FCChartType="AngularGauge" FCDataURL="data/energyMtd.xml"/>
</s:BorderContainer>

和 energyMtd.xml 文件,了解

<?xml version="1.0" encoding="UTF-8"?>
<chart decimals="2"  palette="2" autoScale="1" paletteThemeColor="BDBDBD" showBorder="0" basefontColor="000000" 
    toolTipBgColor="BFBFBF" gaugeFillMix="{dark-10},{light-70},{dark-10}" gaugeFillRatio="3" 
    pivotRadius="6" gaugeInnerRadius="60%" tickValueDistance="10" showTickValues="1" tickValueStep="2" 
    placeTicksInside="0" placeValuesInside="0" showToolTip="1" baseFontSize="9" adjustTM="0" 
    pivotFillColor="000000" dataStreamURL="" gaugeStartAngle="225" gaugeEndAngle="-45" 
    gaugeOriginX="100" gaugeOriginY="98" gaugeOuterRadius="75" numberSuffix="kW" upperLimit="100" 

lowerLimit="0">

  <colorRange>
    <color minValue="0" maxValue="100" code="bbbaba"/>
  </colorRange>

  <dials>
    <dial value="0" rearExtension="10" baseWidth="10" bgColor="000000"/>
  </dials>

</chart>  

如何从 Flex 侧动态传递 colorRange 中的 upperLimit=""、dial value="" 和 maxValue="" 值。我需要将这 3 个值绘制在角度规融合图上

<?xml version="1.0" encoding="utf-8"?>
<s:BorderContainer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark" 
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                  xmlns:components="com.fusionwidgets.components.*">

    <components:FusionWidgets FCChartType="AngularGauge" FCDataURL="data/energyMtd.xml"/>
</s:BorderContainer>

and energyMtd.xml file as

<?xml version="1.0" encoding="UTF-8"?>
<chart decimals="2"  palette="2" autoScale="1" paletteThemeColor="BDBDBD" showBorder="0" basefontColor="000000" 
    toolTipBgColor="BFBFBF" gaugeFillMix="{dark-10},{light-70},{dark-10}" gaugeFillRatio="3" 
    pivotRadius="6" gaugeInnerRadius="60%" tickValueDistance="10" showTickValues="1" tickValueStep="2" 
    placeTicksInside="0" placeValuesInside="0" showToolTip="1" baseFontSize="9" adjustTM="0" 
    pivotFillColor="000000" dataStreamURL="" gaugeStartAngle="225" gaugeEndAngle="-45" 
    gaugeOriginX="100" gaugeOriginY="98" gaugeOuterRadius="75" numberSuffix="kW" upperLimit="100" 

lowerLimit="0">

  <colorRange>
    <color minValue="0" maxValue="100" code="bbbaba"/>
  </colorRange>

  <dials>
    <dial value="0" rearExtension="10" baseWidth="10" bgColor="000000"/>
  </dials>

</chart>  

how do i pass upperLimit="", dial value="" and maxValue="" values in colorRange dynamically from the flex side. i need these 3 values to plot on the angle gauge fusion chart

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

后eg是否自 2024-10-30 23:01:46

看来你需要稍微改变一下代码。

fw.FCDataXML = xml.toString();
fw.FCRender();

Seem that you need to change the code a bit.

fw.FCDataXML = xml.toString();
fw.FCRender();

江南烟雨〆相思醉 2024-10-30 23:01:46

我相信它应该看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<s:BorderContainer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark" 
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                  xmlns:components="com.fusionwidgets.components.*"
                  creationComplete="init();">

    <fx:Script>
        <![CDATA[
        import flash.events.Event;
        import flash.net.URLLoader;
        import flash.net.URLRequest;
        import mx.collections.ArrayCollection;

        protected var xmlLoader:URLLoader;
        [Bindable]
        protected var xml:XML;

        /**
         * 
         */
        protected function init():void
        {
            xmlLoader = new URLLoader();
            xmlLoader.addEventListener(Event.COMPLETE, parse);
            xmlLoader.load(new URLRequest("data.xml"));
        };

        /**
         * 
         * @param   event
         */
        protected function parse(event:Event):void
        {
            xml = event.target.data;
            xml.ignoreWhitespace = true;
            xml.ignoreComments = true;

            xml.chart.@upperLimit = 100;
            xml.chart.dials.dial.@value = 0;
            xml.chart.colorRange.color.@maxValue = 100;

            fw.dataProvider = new ArrayCollection(xml);
        };
        ]]>
    </fx:Script>

    <components:FusionWidgets id="fw" FCChartType="AngularGauge" />
</s:BorderContainer>

我认为您应该检查组件的文档以获取有关它如何处理数据提供程序的更多详细信息。

祝你好运,
Rob

////////////////////////////////////

您好,

将 XML 文件加载到 XML 对象后您可以设置属性和元素的值。

例如:

xml.chart.@upperLimit = 100;
xml.chart.dials.dial.@value = 0;
xml.chart.colorRange.color.@maxValue = 100;

我希望这是你所需要的,

I believe it should look something like this:

<?xml version="1.0" encoding="utf-8"?>
<s:BorderContainer xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark" 
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                  xmlns:components="com.fusionwidgets.components.*"
                  creationComplete="init();">

    <fx:Script>
        <![CDATA[
        import flash.events.Event;
        import flash.net.URLLoader;
        import flash.net.URLRequest;
        import mx.collections.ArrayCollection;

        protected var xmlLoader:URLLoader;
        [Bindable]
        protected var xml:XML;

        /**
         * 
         */
        protected function init():void
        {
            xmlLoader = new URLLoader();
            xmlLoader.addEventListener(Event.COMPLETE, parse);
            xmlLoader.load(new URLRequest("data.xml"));
        };

        /**
         * 
         * @param   event
         */
        protected function parse(event:Event):void
        {
            xml = event.target.data;
            xml.ignoreWhitespace = true;
            xml.ignoreComments = true;

            xml.chart.@upperLimit = 100;
            xml.chart.dials.dial.@value = 0;
            xml.chart.colorRange.color.@maxValue = 100;

            fw.dataProvider = new ArrayCollection(xml);
        };
        ]]>
    </fx:Script>

    <components:FusionWidgets id="fw" FCChartType="AngularGauge" />
</s:BorderContainer>

I think you should check the component's documentation for more details about how it handles the data provider.

Good luck,
Rob

////////////////////////////////////

Hi,

after you loaded the XML file in to an XML object you can set the attributes' and elements' values.

For instance:

xml.chart.@upperLimit = 100;
xml.chart.dials.dial.@value = 0;
xml.chart.colorRange.color.@maxValue = 100;

I hope this is what you need,
Rob

空‖城人不在 2024-10-30 23:01:46

Angular 仪表仅接受 XML 数据。它不接受 ArrayCollection。

请在传递之前检查是否将 XML 转换为字符串。

您还可以启用仪表的调试模式以查看问题的更多详细信息

Angular gauge only accepts XML data. It does not accept ArrayCollection.

Please check if you are converting the XML to String before passing.

Also you can enable the debug mode of the Gauge to see more details of the issue

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文