0 Replies Latest reply on Aug 10, 2008 5:07 PM by fdrt3

    Cannot get DateTimeAxis to display date labels

    fdrt3
      Hi all.

      I try to use the DateTimeAxis to display date labels without luck. Can you have a look, why this code does not work?

      1. the quote series is build like this:

      from a rpc-call I get the quote-objects (newValues) filled and move them to my candlestick series. The quote.timestamp object is a Date instance.

      var chartObject:Object = new Object();
      chartObject.quotes = new ArrayCollection();
      for each(var quote:Quote in newValues) {
      chartObject.quotes.addItem( {date: quote.timestamp, open: quote.open, high: quote.high, low: quote.low, close: quote.close, customFields: quote.customFields, timeframeFormat: quote.timeframeFormat} );
      }

      Then the candlestick chart should be shown like this:
      <mx:CandlestickChart id="candlestickchart" width="100%" dataProvider="{chartObject.quotes}" x="10" top="60" bottom="30" >
      <mx:verticalAxis>
      <mx:LinearAxis baseAtZero="false"/>
      </mx:verticalAxis>
      <mx:horizontalAxis>
      <mx:DateTimeAxis/>
      </mx:horizontalAxis>
      <mx:series>
      <mx:CandlestickSeries
      openField="open"
      closeField="close"
      highField="high"
      lowField="low">
      </mx:CandlestickSeries>
      </mx:series>
      </mx:CandlestickChart>

      The charts shows as expected, but the labels are not correctly shown. The value, that is used by the DateTimeAxis is the number of the quote-series index instead of the chartObject.quotes.date value. So I get values like 0,1,2,3,4... for the date.

      What do I wrong? I'm missing a "dateField" where I can set the field used from the quote object as date. The keyword "date" seems not to match.

      Does anyone has a working example of a candlestick chart with a DateTimeAxis and an ArrayCollection as dataprovider?

      Thank you
      Carsten