You can set the left and the right gutter to 0 to make the gap smaller and also making the axis not that thick.
On Thu, Aug 6, 2009 at 3:28 PM, Richard Rodseth<[email protected]> wrote: > > > Yes, that's pretty much what I've got now. It's not bad (and some might even > prefer not having the chart re-layout to occupy the freed up space when an > axis is hidden). > > Thanks. > > On Thu, Aug 6, 2009 at 3:16 PM, Vivian Richard <[email protected]> wrote: >> >> >> >> Try this code it does make the axis invisible: >> >> <?xml version="1.0"?> >> <!-- charts/StyledMultipleAxes.mxml --> >> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> >> <mx:Script><![CDATA[ >> import mx.collections.ArrayCollection; >> >> [Bindable] >> public var SMITH:ArrayCollection = new ArrayCollection([ >> {date:"22-Aug-05", close:41.87}, >> {date:"23-Aug-05", close:45.74}, >> {date:"24-Aug-05", close:42.77}, >> {date:"25-Aug-05", close:48.06}, >> ]); >> >> [Bindable] >> public var DECKER:ArrayCollection = new ArrayCollection([ >> {date:"22-Aug-05", close:157.59}, >> {date:"23-Aug-05", close:160.3}, >> {date:"24-Aug-05", close:150.71}, >> {date:"25-Aug-05", close:156.88}, >> ]); >> >> [Bindable] >> public var rightBoolean:Boolean = true; >> [Bindable] >> public var leftBoolean:Boolean = true; >> [Bindable] >> public var deckerColor:Number = 0x224488; >> >> [Bindable] >> public var smithColor:Number = 0x884422; >> ]]></mx:Script> >> >> <mx:Stroke id="h1Stroke" >> color="{smithColor}" >> weight="8" >> alpha=".75" >> caps="square" >> /> >> >> <mx:Stroke id="h2Stroke" >> color="{deckerColor}" >> weight="8" >> alpha=".75" >> caps="square" >> /> >> >> <mx:Panel title="Column Chart With Multiple Axes"> >> <mx:ColumnChart id="myChart" showDataTips="true"> >> <mx:horizontalAxis> >> <mx:CategoryAxis id="h1" categoryField="date"/> >> </mx:horizontalAxis> >> >> <mx:horizontalAxisRenderers> >> <mx:AxisRenderer placement="bottom" axis="{h1}"/> >> </mx:horizontalAxisRenderers> >> >> <mx:verticalAxisRenderers> >> <mx:AxisRenderer placement="left" axis="{v1}" >> visible="{leftBoolean}"> >> <mx:axisStroke>{h1Stroke}</mx:axisStroke> >> </mx:AxisRenderer> >> <mx:AxisRenderer placement="right" axis="{v2}" >> visible="{rightBoolean}"> >> <mx:axisStroke>{h2Stroke}</mx:axisStroke> >> </mx:AxisRenderer> >> </mx:verticalAxisRenderers> >> >> <mx:series> >> <mx:ColumnSeries id="cs1" >> horizontalAxis="{h1}" >> dataProvider="{SMITH}" >> yField="close" >> displayName="SMITH" >> > >> <mx:fill> >> <mx:SolidColor color="{smithColor}"/> >> </mx:fill> >> >> <mx:verticalAxis> >> <mx:LinearAxis id="v1" minimum="40" maximum="50"/> >> </mx:verticalAxis> >> </mx:ColumnSeries> >> <mx:LineSeries id="cs2" >> horizontalAxis="{h1}" >> dataProvider="{DECKER}" >> yField="close" >> displayName="DECKER" >> > >> <mx:verticalAxis> >> <mx:LinearAxis id="v2" minimum="150" >> maximum="170"/> >> </mx:verticalAxis> >> >> <mx:lineStroke> >> <mx:Stroke >> color="{deckerColor}" >> weight="4" >> alpha="1" >> /> >> </mx:lineStroke> >> </mx:LineSeries> >> </mx:series> >> </mx:ColumnChart> >> <mx:Legend dataProvider="{myChart}"/> >> <mx:ControlBar> >> <mx:Button label="SHOW L" click="leftBoolean=true"/> >> <mx:Button label="HIDE L" click="leftBoolean=false"/> >> <mx:Button label="SHOW R" click="rightBoolean=true"/> >> <mx:Button label="HIDE R" click="rightBoolean=false"/> >> </mx:ControlBar> >> </mx:Panel> >> </mx:Application> >> >> On Thu, Aug 6, 2009 at 3:05 PM, Richard Rodseth<[email protected]> wrote: >> > >> > >> > The chart has two sets of dynamically-generated series A & B, one >> > associated >> > with the left axis, one with the right. There are two checkboxes >> > controlling >> > the visibility. I would like each checkbox to remove the corresponding >> > series set, and corresponding axis. So you can view none, A (left), B >> > (right) or A & B (left and right). >> > >> > I was able to get rid of the unwanted third (default) axis only if I >> > defined >> > the verticalAxisRenderers within the body of the LineChart tag rather >> > than >> > using my buidAxisRenderers binding function. If I then call >> > buildAxisRenderers from within buildSeriesList, the axes disappear, but >> > the >> > bogus one reappears as soon as I uncheck both checkboxes. >> > >> > My workaround for now is to leave the verticalAxisRenders property >> > unchanged, but set the visibility flag of each renderer instead. This >> > means >> > the chart does not re-layout. >> > >> > Thanks. >> > >> > On Thu, Aug 6, 2009 at 2:38 PM, Vivian Richard <[email protected]> >> > wrote: >> >> >> >> >> >> >> >> Do you think that you get this gap, because there is another axis >> >> there? >> >> By the way as I understand you need 2 axises - left and right - then >> >> why >> >> are you adding another axis on left and then rendering. Why not just >> >> render the axis that comes with the chart? >> >> >> >> On Thu, Aug 6, 2009 at 1:24 PM, Richard Rodseth<[email protected]> >> >> wrote: >> >> > >> >> > >> >> > I don't think that's it. Seems others have the same issue: >> >> > >> >> > >> >> > >> >> > http://www.nabble.com/flex-charts:-disable-default-verticalAxisRenderer-issue-td22309463.html >> >> > >> >> > Even if I do what that thread suggests as below, I get a gap on the >> >> > left >> >> > when the right axis is added. >> >> > >> >> > private function buildAxisRenderers(showLeftAxis:Boolean, >> >> > showRightAxis:Boolean):Array { >> >> > >> >> > // Workaround >> >> > var verticalAxisRenderer:AxisRenderer = new >> >> > AxisRenderer(); >> >> > verticalAxisRenderer.visible = false; >> >> > verticalAxisRenderer.height = 0; >> >> > verticalAxisRenderer.width = 0; >> >> > verticalAxisRenderer.setStyle("showLabels", false); >> >> > lineChart.verticalAxisRenderer = verticalAxisRenderer; >> >> > >> >> > if (showLeftAxis && showRightAxis) >> >> > return [ leftAxisRenderer, rightAxisRenderer]; >> >> > if (showLeftAxis && !showRightAxis) >> >> > return [ leftAxisRenderer ]; >> >> > if (showRightAxis && !showLeftAxis) >> >> > return [ rightAxisRenderer ]; >> >> > return [ ]; >> >> > >> >> > } >> >> > >> >> > >> >> > On Thu, Aug 6, 2009 at 12:45 PM, Vivian Richard <[email protected]> >> >> > wrote: >> >> >> >> >> >> >> >> >> >> >> >> I guess you are adding an additional axis. As you know if you >> >> >> do not define your axis and put an id for it. The chart will add >> >> >> the default axis. Now do not do it that way declare both axis >> >> >> and then tie up the axis renderer with it. I guess that will resolve >> >> >> you issue. >> >> >> >> >> >> Here you can see the example: >> >> >> http://livedocs.adobe.com/flex/3/langref/mx/charts/AxisRenderer.html >> >> >> >> >> >> On Thu, Aug 6, 2009 at 11:52 AM, Richard Rodseth<[email protected]> >> >> >> wrote: >> >> >> > >> >> >> > >> >> >> > I have a line chart where the user can show/hide the left and >> >> >> > right >> >> >> > axes >> >> >> > (which have custom colours) and the corresponding series. >> >> >> > >> >> >> > <mx:LineChart >> >> >> > dataProvider="{...}" >> >> >> > >> >> >> > verticalAxisRenderers="{this.buildAxisRenderers(...)}" >> >> >> > series="{this.buildSeriesList(...)}" >> >> >> > > >> >> >> > >> >> >> > Works fine, except I get two left axes, my custom one and the >> >> >> > default >> >> >> > grey one which never goes away. Any ideas? Thanks in advance. >> >> >> > >> >> >> > >> >> >> > >> >> > >> >> > >> > >> > > >

