3 Replies Latest reply on Feb 14, 2008 8:55 PM by CJSteu

    Computed Max and Min

    CJSteu Level 1
      How do i use Computed Maximum and Computed Minium to set values for vertical axis with HLOC Chart programmatically? I am using an Array Collection, below, TICKERS, I would like to use the HIGH value in the collection * some constant (1.25 or .75 for high and low), as the Computed Maximum and Computed Minimum value.

      <mx:LinearAxis computedMaximum="[TICKER:HIGH] * 1.25">

      (this code does not work of course)

      This is my array collection:

      public var TICKER:ArrayCollection = new ArrayCollection([
      {date:"1, 8, 2005",open:42.57,high:43.08,low:42.08,close:42.75,volume:300},
      {date:"2, 8, 2005",open:42.89,high:43.5,low:42.61,close:43.19,volume:350},
      {date:"3, 8, 2005",open:43.19,high:43.31,low:42.77,close:43.22,volume:400},
      {date:"4, 8, 2005",open:42.89,high:43,low:42.29,close:42.71,volume:220},
      {date:"5, 8, 2005",open:42.49,high:43.36,low:42.02,close:42.99,volume:275},
      {date:"8, 8, 2005",open:43,high:43.25,low:42.61,close:42.65,volume:400},
      {date:"9, 8, 2005",open:42.93,high:43.89,low:42.91,close:43.82,volume:330},
      {date:"10, 8, 2005",open:44,high:44.39,low:43.31,close:43.38,volume:425},
      {date:"11, 8, 2005",open:43.39,high:44.12,low:43.25,close:44,volume:350},
      {date:"12, 8, 2005",open:43.46,high:46.22,low:43.36,close:46.1,volume:315},

        • 1. Re: Computed Max and Min
          You could set maximum="{findComputedMaximum()}" then define the function in a script tag and in the function find the max then multiply it by 1.25 and return it.

          <mx:LinearAxis maximum="{findComputedMaximum()}">

          private function findComputedMaximum() :Number
          var sort:Sort = new Sort();
          sort.fields = [new SortField("high",true,true,true)];
          TICKER.sort = sort;
          var max:Number = TICKER.getItemAt(0);
          return max * 1.25;
          • 2. Re: Computed Max and Min
            CJSteu Level 1
            that is so helpful thank you for answering my question...
            • 3. Re: Computed Max and Min
              CJSteu Level 1
              Hey AS3Dev,
              Can you help me with a question (kinda related to Forum post)...
              I am trying to figure out why my maximum valule for HOLC Chart Series will not extend the length of the Chart Component Horizontally no matter how I set scale or size, it seems of anything. I am using a date value of course, for x, horizontal, and it will never extend past 70 - 75% of chart. I would like it to be the full length of the rendered chart.
              Any help is appreciated.