开发者

FLEX 4: How do you add a single horizontal line in a Chart/Graph

Here is my question: I have a hybrid chart that uses bars and lines I want to add to the right vertical axis a horizontal line that represents a break even

<mx:ColumnChart id="cvpaOpenCloseRatio" x="79" y="107"
                dataProvider="{CF_Closed_to_Opened_by_MonthResult.last开发者_开发问答Result}"
                showDataTips="true">
    <mx:horizontalAxis>
        <mx:CategoryAxis id="categoryAxis" categoryField="Month"/>
    </mx:horizontalAxis>
    <mx:verticalAxisRenderers>
        <mx:AxisRenderer placement="left" axis="{v1}"/>
        <mx:AxisRenderer placement="right" axis="{v2}"/>
    </mx:verticalAxisRenderers>     


    <mx:series>
        <mx:ColumnSeries id="columnSeries" 
                         displayName="Total Closed" 
                         yField="ClosedCount" 
                         xField="Month" 
                         >
            <mx:verticalAxis>
                <mx:LinearAxis id="v1" minimum="0" maximum="300"/>
            </mx:verticalAxis>
        </mx:ColumnSeries>

        <mx:ColumnSeries id="columnSeries2" 
                         displayName="Total Opened" 
                         yField="OpenCount" 
                         xField="Month" 
        ></mx:ColumnSeries>


        <mx:LineSeries id="columnSeries3" displayName="Closed/OpenRatio" yField="ClosedToOpenRatio" xField="Month"
                       >
            <mx:verticalAxis>
                <mx:LinearAxis id="v2" minimum="0" maximum="3" />
            </mx:verticalAxis>
        </mx:LineSeries>

            <!--mx:LineSeries id="columnSeries4" displayName="Target" xField="Month" yField="1.5" verticalAxis="{v2}" horizontalAxis="{categoryAxis}"  /-->

    </mx:series>



</mx:ColumnChart>   
<mx:Legend dataProvider="{cvpaOpenCloseRatio}"/>

I was trying to achieve this with

<mx:LineSeries id="columnSeries4" displayName="Target" xField="Month" yField="1.5" verticalAxis="{v2}" horizontalAxis="{categoryAxis}"  />

so to clarify the break even line is a horisontal line located at 1.5 with respect to the right side verticalAxis.

Thanks in advance Nate


You were almost there, you just need to specify a custom item renderer for the line in the LineSeries. Example here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜