0 Replies Latest reply on Mar 29, 2010 11:40 AM by Rick824

    ColumnChart with a horizontal line

    Rick824

      We have a requirement for a limit line (horizontal line) on a ColumnChart. Is there a way to draw this without using a LineSeries?  Using a LineSeries will decrease the widths of the bars and will also start at the first data point rather than at the y-axis. The following code is a slightly modified example from the Adobe manual.

       

       

      <?xml version="1.0"?>

      <!-- charts/MultipleSeries.mxml -->

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="500"

      height="600">

        <mx:Script>

          <![CDATA[

              [Bindable]

              public var SMITH:Array = [

                 {date:"22-Aug-05", close:45.87},

                 {date:"23-Aug-05", close:45.74},

                 {date:"24-Aug-05", close:45.77},

                 {date:"25-Aug-05", close:46.06},

              ];

              [Bindable]

              public var AVERAGE:Array = [

                 {date:"22-Aug-05", close:45},

                 {date:"23-Aug-05", close:45},

                 {date:"24-Aug-05", close:45},

                 {date:"25-Aug-05", close:45},

              ];

          ]]>

        </mx:Script>

       

        <mx:Panel title="Multiple Data Series" width="400" height="400">

           <mx:ColumnChart id="myChart"

              dataProvider="{SMITH}"

              showDataTips="true"

              height="250"

              width="350"

           >

              <mx:horizontalAxis>

                 <mx:CategoryAxis categoryField="date"/>

              </mx:horizontalAxis>

              <mx:verticalAxis>

                 <mx:LinearAxis minimum="40" maximum="50"/>

              </mx:verticalAxis>

              <mx:series>

                 <mx:ColumnSeries

                      dataProvider="{SMITH}"

                      xField="date"

                      yField="close"

                      displayName="SMITH"

                 >

                 </mx:ColumnSeries>

                 <mx:LineSeries

                      dataProvider="{AVERAGE}"

                      xField="date"

                      yField="close"

                      displayName="AVERAGE"

                 >

                 </mx:LineSeries>

              </mx:series>

           </mx:ColumnChart>

           <mx:Legend dataProvider="{myChart}"/>

        </mx:Panel>

      </mx:Application>