I just had to add this line at the end of the initApp() function and it works.
myChart.verticalAxis = lnrAxis; Thanks, Om On Thu, Jun 2, 2016 at 12:32 AM, Patil, Virat <[email protected]> wrote: > Hello > > I have created Sample Example > > <?xml version="1.0" encoding="utf-8"?> > <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" > xmlns:s="library:// > ns.adobe.com/flex/spark" > xmlns:mx="library:// > ns.adobe.com/flex/mx" creationComplete="initApp()"> > > > > <fx:Declarations> > <!-- Place non-visual elements (e.g., services, value > objects) here --> > </fx:Declarations> > <fx:Script> > <![CDATA[ > import mx.charts.AxisRenderer; > import mx.charts.CategoryAxis; > import mx.charts.LinearAxis; > import mx.charts.series.LineSeries; > import mx.collections.ArrayCollection; > import mx.events.FlexEvent; > [Bindable] > public var expenses:ArrayCollection = new > ArrayCollection([ > {Month:"Jan", Profit:2000, Expenses:1500, > Amount:450}, > {Month:"Feb", Profit:1000, Expenses:200, > Amount:600}, > {Month:"Mar", Profit:1500, Expenses:500, > Amount:300} > ]); > > [Bindable]private var lnrAxis:LinearAxis; > public function initApp():void > { > var localSeries:LineSeries = new > LineSeries(); > var axisRend:AxisRenderer; > lnrAxis = new LinearAxis(); > lnrAxis.title = "Vertical Title"; > axisRend = new AxisRenderer(); > axisRend.axis =lnrAxis; > localSeries.yField = "Profit"; > localSeries.xField = "Month"; > localSeries.verticalAxis =lnrAxis; > localSeries.displayName = > localSeries.yField; > var currentSeries:Array = myChart.series; > currentSeries.push(localSeries); > myChart.series = currentSeries; > var hAxis:CategoryAxis = new > CategoryAxis(); > hAxis.categoryField = "Month"; > hAxis.title = 'Horizontal Title'; > myChart.horizontalAxis = hAxis; > myChart.dataProvider=expenses; > > > myChart.horizontalAxis = hAxis; > } > > > > ]]> > </fx:Script> > <s:layout> > <s:VerticalLayout/> > </s:layout> > <mx:Panel title="Line Chart with Variable Number of Series"> > <mx:LineChart id="myChart" showDataTips="true"> > </mx:LineChart> > <mx:Legend dataProvider="{myChart}"/> > > </mx:Panel> > > </s:WindowedApplication> > > > Regards > Virat I Patil > > -----Original Message----- > From: [email protected] [mailto:[email protected]] On Behalf Of OmPrakash > Muppirala > Sent: Thursday, June 02, 2016 11:37 AM > To: [email protected] > Subject: Re: Setting Title to LinearAxis at Runtime do not show up > > A code snippet would help folks understand the issue better. > > On Wed, Jun 1, 2016 at 10:20 PM, Patil, Virat <[email protected]> > wrote: > > > We are creating a ColumnChart at runtime. So we have a linear axis as > > vertical axis for chart also it has AxisRenderer. > > Also we are assigning the title to Axis (Linear Axis) but its not > > getting displayed when chart is displayed on screen > > > > Regards > > Virat I Patil > > > > -----Original Message----- > > From: [email protected] [mailto:[email protected]] On Behalf Of > > OmPrakash Muppirala > > Sent: Wednesday, June 01, 2016 11:41 PM > > To: [email protected] > > Subject: Re: Setting Title to LinearAxis at Runtime do not show up > > > > What are you trying? > > > > Thanks, > > Om > > > > On Wed, Jun 1, 2016 at 12:01 AM, Patil, Virat > > <[email protected]> > > wrote: > > > > > Hello > > > > > > We are trying to set the title to Linear Axis for chart which is > > > created at runtime. But the title do not show up Did anyone face > > > similar issue? > > > > > > Regards > > > Virat I Patil > > > This message contains information that may be privileged or > > > confidential and is the property of the Capgemini Group. It is > > > intended only for the person to whom it is addressed. If you are not > > > the intended recipient, you are not authorized to read, print, > > > retain, copy, disseminate, distribute, or use this message or any > > > part thereof. If you receive this message in error, please notify > > > the sender immediately and delete all copies of this message. > > > > > This message contains information that may be privileged or > > confidential and is the property of the Capgemini Group. It is > > intended only for the person to whom it is addressed. If you are not > > the intended recipient, you are not authorized to read, print, retain, > > copy, disseminate, distribute, or use this message or any part > > thereof. If you receive this message in error, please notify the > > sender immediately and delete all copies of this message. > > > This message contains information that may be privileged or confidential > and is the property of the Capgemini Group. It is intended only for the > person to whom it is addressed. If you are not the intended recipient, you > are not authorized to read, print, retain, copy, disseminate, distribute, > or use this message or any part thereof. If you receive this message in > error, please notify the sender immediately and delete all copies of this > message. >
