Chart with http data does not work

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default Chart with http data does not work

    I try to create a chart with live http data.
    I cannot figure how to make the chart appear correctly.
    With the same code, if I bind statically the XML generated by my servlet, it
    works fine.
    However, with live data, it does not. I know that my servlet is called, but I
    suspect that it is called too late maybe.

    Here is the code :

    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
    initialize="retrieveData()">
    <mx:HTTPService id="inventory" contentType="application/xml" method="GET"
    protocol="http"
    url="getInventory" fault="trace(event.fault.faultstring)"
    resultFormat="object">
    </mx:HTTPService>

    <!-- <mx:Model id="results" source="chartdata.xml"/> -->

    <mx:Script>
    <![CDATA[

    var objkey : String ;
    var results ;

    function retrieveData( )
    {
    inventory.url = "getInventory?objkey=" + objkey ;
    inventory.send() ;
    }
    ]]>
    </mx:Script>


    <mx:ColumnChart id="chart" width="100%" height="100%"
    dataProvider="{inventory.result.objectClass}" showDataTips="true">

    <mx:horizontalAxis>
    <mx:CategoryAxis dataProvider="{inventory.result.objectClass}"
    categoryField="name"/>
    </mx:horizontalAxis>

    <mx:series>
    <mx:Array>
    <mx:ColumnSeries yField="count"/>
    </mx:Array>
    </mx:series>

    </mx:ColumnChart>
    </mx:Application>

    And here is XML data:

    <data>
    <objectClass name="File-Assignments">
    <count>16430</count>
    </objectClass>
    <objectClass name="Phys-Files">
    <count>9668</count>
    </objectClass>
    </data>

    kohinoor75 Guest

  2. Similar Questions and Discussions

    1. Chart Hit Data
      I've got an issue with a chart control which is positioned far right on the screen of a dashboard. When hovering over a column data series, the...
    2. Refreshing chart data doesnt update chart
      I must be missing something simple here. I have a column chart that is using an array for its dataprovider. However, when I update the underlying...
    3. Help grouping chart data
      I have a line chart with each axi defined as follows; x is defined by time, and y is defined by bytes. My issue is the data is coming across for two...
    4. Updating the data on a Chart
      Hi, I'm trying to invalidate the data of a Chart by calling invalidateData (which is defined in ChartBase and supposedly inherited in PieChart,...
    5. Chart from SQL-server data
      Hi ! I'm new to asp. I have made a page to display a chart based on data from my SQL-server. I have used Office Web-component graph. Here I can...
  3. #2

    Default Re: Chart with http data does not work

    I don't think you can include parameters on the url. Instead, use a request
    object, like this:
    inventory.url = "getInventory";
    inventory.send({objkey : objkey }) ;

    Binding problems are difficult to debug so I always first use a reault handler
    called by the data services result event. In that handler function I can rais
    an alert to make sure the data callis returning and then I can inspect the
    contents of the result object to verify is structure.

    And once I have done that, I usually just assign the result.whatever to the
    dataProvider.

    Tracy

    ntsiii Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139