4 Replies Latest reply on Jul 26, 2010 8:20 AM by rtalton

    Columnchart with horizontal line representing setpoint

    goflashman Level 1

      Hi,

       

      I have a simple column chart. I want to be able to draw a single thin line horizontally across the chart to represent a setpoint. How can I accomplish this?

       

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
        <mx:Script><![CDATA[
           import mx.collections.ArrayCollection;
           [Bindable]
           public var expenses:ArrayCollection = new ArrayCollection([
              {Month:"Jan", Profit:2000, Expenses:1500},
              {Month:"Feb", Profit:1000, Expenses:200},
              {Month:"Mar", Profit:1500, Expenses:500}
           ]);
        ]]></mx:Script>
        <mx:Panel title="Column Chart">
           <mx:ColumnChart id="myChart" dataProvider="{expenses}" showDataTips="true">
              <mx:horizontalAxis>
                 <mx:CategoryAxis
                      dataProvider="{expenses}"
                      categoryField="Month"
                 />
              </mx:horizontalAxis>
              <mx:series>
                 <mx:ColumnSeries
                      xField="Month"
                      yField="Profit"
                      displayName="Profit"
                 />
                 <mx:ColumnSeries
                      xField="Month"
                      yField="Expenses"
                      displayName="Expenses"
                 />
              </mx:series>
           </mx:ColumnChart>
           <mx:Legend dataProvider="{myChart}"/>
        </mx:Panel>
      </mx:Application>

       

      Thanks in advance