1 Reply Latest reply on Nov 19, 2009 5:44 AM by PoorOldCoder

    Newbie: trying to add a template chart series to a new tab

    PoorOldCoder Level 1

      I have this idea where I want to get a time series when the user clicks a button and then create a chart and add it to a new tab. Should be simple enough.

       

      I have my simple chart below that I want to chart.

       

      Do I

      1) try to do something with templating, i am reading some code about UIComponent etc, not really understabnding it

      2) write some manual code that does all the same stuff as the MXML below, and then automatically adds this as a child to a tab object

      3) something else entirely.

       

       

       

                  <mx:Canvas label="Tab 1" width="100%" height="100%">
                  <mx:Panel title="TimeSeries Chart"
                      height="491" width="589" layout="horizontal" x="10" y="5">
                      <mx:LineChart id="linechart" height="100%" width="100%"
                          paddingLeft="5" paddingRight="5"
                          showDataTips="true" dataProvider="{tsRPC.lastResult.DataPoint}">      
                      <mx:horizontalAxis>
                          <mx:CategoryAxis id="ca" categoryField="@Date" title="Date" />
                      </mx:horizontalAxis>
                          <mx:series>
                              <mx:LineSeries yField="@Value" form="curve" displayName="bps" lineStroke="{s1}"/>
                          </mx:series>
                      </mx:LineChart>
                      <mx:Legend dataProvider="{linechart}"/>
                  </mx:Panel>
                  <mx:TextArea x="631" y="10" id="textarea" width="257" height="471" backgroundColor="#7D1E71"/>
              </mx:Canvas>