开发者

Is it possible to hide the axis of a flex chart and have it not take up any space?

Is it possible to tell flex to display a chart with no visible axis? I want the contents of the chart to take up all the available space. I can set the visibility on the AxisRenderer to false which will hide the axis but that leaves an empty space where the axis would usually be. How can I remove this empty space?

   <mx:horizontalAxis>
      <mx:DateTimeAxis id="xAxis" dataUnits="hours" />
   </mx:horizontalAxis>
   <mx:horizontalAxisRenderers>
      <mx:AxisRenderer axis="{xAxi开发者_如何学运维s}" visible="false" height="0" />
   </mx:horizontalAxisRenderers>

I've tried setting the height on the renderer but that has no effect, and there is no height style on the axis itself.


You need to set the size of each elements in the AxisRenderer to 0. Try this in reference to the documentation : Setting padding properties

   <mx:horizontalAxisRenderers>
      <mx:AxisRenderer axis="{xAxis}" 
                       minorTickPlacement="none" 
                       tickPlacement="none" 
                       labelGap="0" 
                       showLabels="false" 
                       showLine="false" />
   </mx:horizontalAxisRenderers>

There still one pixel on borders but you can set padding to -1 as trick, currently i don't find something better.

<mx:BarChart dataProvider="{data}"
             paddingBottom="-1" 
             paddingLeft="-1"
             paddingRight="-1"
             paddingTop="-1">


This goes for all flex components - visible='false' makes them disappear from the view. But they are actually still there, not being drawn, but taking place. There's a second parameter called includeInLayout which, when set to false, makes them stop taking place.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜