我正在尝试在flex中隐藏垂直轴渲染器和水平轴渲染器,以便在没有它们的情况下为图表拍照。

我将两个渲染器都设置为visible = false和includeInLayout = false。它们不会出现,但仍会占用空间。我试过将widths / heights设置为0,但这也无济于事。

        <mx:horizontalAxisRenderers>
        <mx:AxisRenderer
            id="horizontalAxisRenderer"
            axis="{dtAxis}"
            axisStroke="{axis}"
            placement="bottom"
            minorTickPlacement="outside"
            minorTickLength="10"
            tickLength="12"
            tickPlacement="outside"
            color="0x707275"
            styleName="axisStyle"
            visible="false"
            includeInLayout="false"
            >
            <mx:tickStroke>{ticks}</mx:tickStroke>
            <mx:minorTickStroke>{mticks}</mx:minorTickStroke>
        </mx:AxisRenderer>
    </mx:horizontalAxisRenderers>

    <mx:verticalAxisRenderers>
        <mx:AxisRenderer
            id="verticalAxisRenderer"
            axis="{laMain}"
            axisStroke="{axis}"
            placement="bottom"
            minorTickPlacement="outside"
            minorTickLength="10"
            tickLength="12"
            tickPlacement="outside"
            fontSize="15"
            color="0x707275"
            labelGap="0"
            styleName="axisStyle"
            visible="false"
            includeInLayout="false"
            >
            <mx:tickStroke>{ticks}</mx:tickStroke>
            <mx:minorTickStroke>{mticks}</mx:minorTickStroke>
        </mx:AxisRenderer>
    </mx:verticalAxisRenderers>

最佳答案

一个类似的问题was asked here,并基于this answer,我找到了成功。尝试执行以下操作,如果需要,将LinearType的轴类型调整为您可能正在使用的任何轴:

  <mx:horizontalAxis>
    <mx:LinearAxis id="myXAxis" />
  </mx:horizontalAxis>
  <mx:horizontalAxisRenderers>
    <mx:AxisRenderer axis="{myXAxis}"
                     minorTickPlacement="none"
                     tickPlacement="none"
                     labelGap="0"
                     showLabels="false" showLine="false"
                     visible="false" includeInLayout="false" />
  </mx:horizontalAxisRenderers>


我仍然需要保持渲染器和轴之间的绑定。没有它,该应用程序似乎根本就不想加载。

关于apache-flex - 删除布局中的Flex Chart AxisRenderer?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5364568/

10-16 13:55