DYNAMIC CREATION OF LINE SERIES USING ACTIONSCRIPT

There's something wierd about flex or im doing something
wrong?
- when i create a line series manually using mxml and specify
a id for the series, it works.
- similarly when i try to dynamically create a line series
using actionscript & define an "id" property, flex does not
understand! what am i doing wrong?
code for reference:
private function addSeries(series:Array,
yField:String,id:String) // addseries(series,"date","1000")
var ls:LineSeries= new LineSeries();
var stroke:Stroke = new Stroke()
ls.yField = yField;
ls.xField="ts"
ls.dataProvider=dp
ls.id=id // tried defining it dynamically, but flex does not
find
this.mychart.series.push(ls)
THIS IS THE ERROR I GET : "TypeError: Error #1010: A term is
undefined and has no properties."

I see... I played around with the line chart ...
Hopefully this helps... if not forgive me...
I know why you are trying to use the id property which i
agree doesn't work.
since the series is an array in your lineChart use the index
to set the visible property false/true.
lineChart.series[0].visible = true/false;
<mx:Lineseries id="a1" visible="true"
dataProvider="{whatever}" />
<mx:Lineseries id="a2" visible="false"
dataProvider="{whatever}"/>
create a function called init();
public function init():void
var lineS1:LineSeries = new LineSeries();
lineS1.visible = true/false;
lineChart.series.push(lineS1);
var lineS2:LineSeries = new LineSeries();
lineS2.visible = true/false;
lineChart.series.push(lineS2);
... and the key is to call this init function on initialize
event...NOT on createComplete event
<mx:LineChart.... initialize="init()" .... />
and to show both lines... call this function...
public function showLines():void
lineChart.series[0].visible = true;
lineChart.series[1].visible = true;
Hope this helps....

Similar Messages

  • How to dynamically add new line series to the line chart in flex?

    i need to add line series dynamically..and each line  series should have a different data provider...

    A chart can have only 1 dataProvider which in my case is an ArrayCollection.
    The chart will update every time the dataProvider changes if you use binding.
    So you have to write a function that periodically populates the ArrayCollection with data from the server and the chart will update automatically.
    'Using line charts' tutorial from Adobe: http://livedocs.adobe.com/flex/3/html/charts_types_08.html#243339

  • SHOW / HIDE -  line series using checkbox

    how do i show & hide a line series based on checkboxes?
    tried applying series id- doesn't seem to work!
    Any Body!

    thanks that worked oddsy,
    now im facing problem to show the hidden series through
    actionscript
    im doing something like this:
    while generation i hide the series
    pasting the function for reference:
    public function addSeries(series:Array, yField:String,
    id:String, color:uint,dp:ArrayCollection,vis:Boolean):void
    var ls:LineSeries= new LineSeries();
    var stroke:Stroke = new Stroke()
    ls.yField = yField;
    ls.xField="ts"
    ls.dataProvider=dp
    stroke.color = color;
    stroke.weight = 1.5;
    ls.setStyle("lineStroke", stroke);
    ls.alpha=.8
    ls.visible=vis
    ls.id=id
    var temp:Array = series;
    temp.push(ls);
    series = temp;
    mychart.series = series;
    thru action script i try this : if checkbox selected do -
    > mychart.series[0].visible=true ,
    mychart.series[1].visible=true....so on
    but it doesn't show the series! what shud i do?

  • Dynamic Creation of a Database Using Coldfusion

    Here is what i want to do.
    Through the simple click of a button on want to dynamicly create a new databas
    e for a completely new user.   I have a database already designed but what i want is for that database to act as my "perfect database image"  that can be replicated for use by other users on the system. I not only need to have  the DB dynamically created or copied I need to be able to create the ODBC connection in coldfusion so that the user can start using the database without any customer service.  I am using MSSQL 2005. thank you.

    1. Create a stored procedure that:
                a. Creates a database exactly like your original design (tables, columns, data types etc)
                b. With required parameters like username, password, dataSource
    2. Provide a form for the user to fill (fields to include applicable parameters - password etc)
    3. Form action attribute should point to a page that will invoke the stored procedure, passing in all required parameters
    4. Build in checks to avoid multiple database creation by one user (except you want to allow it)
    5.  It may be better to provide a means for user to delete his/her own database or table

  • Dynamic change color of series in line chart

    Hi
    I would like to be able to dynamically change the color of the individual series in a line chart, based on user preference. It works excellent having dynamic labels on the series using the &item. syntax and a before header computation.
    The same approach for the color does not seem to work. I get errors like undefined entity....
    Any ideas?
    Best regards Jesper

    Very surprisingly the following code (also generated by the macro recording) works ok.
    (I selected the serie inside the chart instead of selecting the serie in the legend)
        ActiveChart.FullSeriesCollection(1).Select
        With Selection.Format.Fill
            .Visible = msoTrue
            .ForeColor.ObjectThemeColor = msoThemeColorAccent3
            .ForeColor.TintAndShade = 0
            .ForeColor.Brightness = -0.25
            .Transparency = 0.3000000119
            .Solid
        End With
    If an MVP or Microsoft official come accross this, I suggest further testing as it is very likely a bug (with the first set of code generated by Excel)

  • Newbie: trying to use XML in a Line Series.

    So, I have a similar question to my last one, how to connect some XML from an RPC to a line series. The XML comes across fine. Problem is, why does it not work below?
    The XML is simple, and I use dataProvider="{tsRPC.lastResult.TIMESERIES}"....then yField="DataPoint.Value"...but it does not work
    I have seen some examples that use the "data.something"...where data must be some internal object. I tried various combinations of everything.
    <TIMESERIES>
      <DataPoint Date="38000" Value="34.51"/>
      <DataPoint Date="38001" Value="35.06"/>
    </TIMESERIES>
        <mx:HTTPService id="tsRPC"
            url="http://localhost:6574/Test2/TimeSeriesServer"
            resultFormat="e4x">
        </mx:HTTPService>
    <mx:Panel title="LineChart and AreaChart Controls Example3"
            height="491" width="729" layout="horizontal" x="350" y="84">
            <mx:LineChart id="linechart" height="100%" width="100%"
                paddingLeft="5" paddingRight="5"
                showDataTips="true" dataProvider="{tsRPC.lastResult.TIMESERIES}">      
            <mx:horizontalAxis>
                <mx:CategoryAxis id="ca" categoryField="DataPoint.Date" title="Date" />
            </mx:horizontalAxis>
                <mx:series>
                    <mx:LineSeries yField="DataPoint.Value" form="curve" displayName="Profit" lineStroke="{s1}"/>
                </mx:series>
            </mx:LineChart>
            <mx:Legend dataProvider="{linechart}"/>
        </mx:Panel>

    thanks paul.
    I am learning now about e4x. For those who don't know...
    http://www.actionscript.org/resources/articles/222/1/Intro-to-E4X/Page1.html
    For those that don't know E4X stands for ECMAScript for XML and this specification introduces some new functionality that makes working with XML a lot simpler. New to AS3 are the XML, XMLList,QSpace and Namespace E4X classes. E4X not only makes life simpler but provides greater code consistency and familiarity (we can use dot syntax more similiar to ActionScript).

  • Newbie - how to change the color of a line using ActionScript?

    This must be the most basic question in the world, but I've
    been searching the documentation for an hour.
    All I want to do is to draw a line on the stage, and then
    change its color (or endpoint positions) dynamically using
    ActionScript.
    This is the 1st step to creating complicated dynamic
    animations... (No, I do not want to use the timeline, I want to do
    it dynamically.)
    Yet a line can't be an instance, so I'm confused -- how can I
    possibly do this? Is there some key concept I'm missing here?
    Thanks
    Michael

    AS2 required you to create your own function for doing
    primitive shapes. In AS3 that has changed and the graphics package
    includes not only the old AS2 drawing API but also has methods for
    doing squares, circles etc.
    If you are a VB programmer, my honest opinion is to leave
    your traditional OOP mindset at the door when using Flash.
    Actionscript is still in its infancy and although AS3 does really
    strive for OOP oneness, it isn't there 100% like VB is which has
    been around 20 years longer and gone through numerous additions
    etc. Whenever I learn a new language VB, PHP, C, AS, Java....I try
    my best to look at the language as its own identity. All language
    share similarities but they all have their own idiosyncrisies. Keep
    an open mind and you'll find what you need.
    Most of the seasoned guys here will also tell you that
    although the documentation is decent, you are better off going out
    and picking up a book on Flash 8/CS3 and another one on
    Actionscript. Familiarize yourself with the program that way.
    With your programming background, I'd recommend picking up
    Essential AS2 (or AS3) by Moock depending on your version of Flash.
    Also, if you are more interested in the programmatic side of Flash,
    why not look into Flex Builder and AIR. Since it is purely a
    programming environment (no Flash IDE), you'd be more
    comfortable.

  • How to add line series dynamically to a line chart in flex?

    hi..i need to add line series dynamically to a line chart..depending on an array..the application is this..i have an array which stores the details of the users connected to an fmi server..the chart should display the bandwidth of each client..so the users should be added and removed from the chart dynamically...

    Hi
    1.I am giving you solution for dynamically adding values to the dropdown
    public void addValue( )  //Method Name in Component controller
        //@@begin addValue()
              IWDNodeInfo nodeinfo = wdContext.nodeNodeTestData().getNodeInfo();// Node should be map to the view's Node
              IWDAttributeInfo att = nodeinfo.getAttribute("VechileTypes");// Attribute by which dropdown in bound//
              IModifiableSimpleValueSet svSet = att.getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();
              svSet.put(wdContext.currentNodeTestDataElement().getInpAtt(),wdContext.currentNodeTestDataElement().getInpAtt());
        //@@end
    2.   wdThis.wdGetLangCompController().addValue(); // call this method in the point where u want to add values to the dropdown.

  • AnyChart: Dynamically add/remove series using javascript

    Hi all,
    The examples on the following page they dynamically show/hide series using javascript without any server side action.
    http://www.anychart.com/products/anychart/docs/users-guide/livesamples/js-series/index.html
    It seems they can do this because they add the chart to the page using javascript and so other js scripts can access a reference to the chart object. Looking at the code generated when you add a flash chart using Apex, it appears they are embedded flash. Does this stop us from using javascript to manipulate the chart object?
    Has anyone managed to do something like the example in the page above using the built-in charting of Apex?

    Between me and another poster we've sort of worked out a solution here - Re: Apex 4.0.2 Manipulate Flash Charts using Javascript?

  • Dynamic Smooth Curve using ActionScript

    Hi,
    Can anyone help me to solve my problem?
    I want to draw a smoth Ogive curve using ActionScript. The
    shape of the curve can be changed by setting the new values in the
    FLA file.
    Thanks in advance.
    Thanks
    Razzak

    I'd suggest you have a look at the MovieClip.curveTo() method
    in the Help.
    It gives a good example of drawing a circle.
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Dynamic creation of ComponentUsage

    Hi people,
    I want to reuse a view (ViewA) in different views (ViewB, ViewC, ViewD).ViewA has a quite complex logic, so it is necessary to outsource this view.  Not only the logic, but also the count of UIElements and contextelements is quite large, for this I don't want to implement this part redundant in the views A, C and D.
    I have to use ViewA in a table in  the TablePopin UIElement. Every line of the table should have its own instance of ViewA. Is that possible?
    My idea is it, to put the view in an own component. For every tableline I need an instance of the componentUsage. My problem is now, that I'm not able to create at runtime a ComponentUsage and at designtime I don't know how many instances I need. Is it possible in webdynpro to create dynamic instances of ComponentUsage?
    If you know an other way, that prevents me from implementing the view and its logic more times, please tell me!
    Thanks in  advance,
    Thomas Morandell

    Hi Thomas,
    just for clarification. Principally it is possible in Web Dynpro to dynamically create new component usages of the same type like an existing, statically declared one. This means after having defined a component usage of type ISomeComp (component interface definition) you can dynamically create new component usages which all point to the same component interface definition ISomeComp:
    wdThis.wdGetISomeCompUsage().createComponentUsageOfSameType();
    But this dynamic creation approach implies, that you must also embed the component interface view of this component usage to the view composition dynamically; and this is (unfortunately) quite cumbersome and complicated based on the existing Web Dynpro Java API (it is not yet optimized for a simple dynamic view composition modification.
    Additionally, like Valery pointed out, the dynamic creation of new component usages is not compatible with table popins.
    Regards, Bertram

  • Dynamic creation of business graphics.

    Hi,
    i have a piece of code which dynamically create a business graphics. If i use the same node data and create BG in statically.. i am able to view the graph. In case of dynamic creation , i am getting graphical rendering error. Have i missed something here..
    The piece of code i had used is..
         IWDBusinessGraphics bg = (IWDBusinessGraphics)view.createElement(IWDBusinessGraphics.class,null);
              IWDCategory c = (IWDCategory)view.createElement(IWDCategory.class,null);
         //     c.setDescription("tableutility");      
              c.bindDescription(wdContext.getNodeInfo().getAttribute(IPrivateSDNUtilityView.IContextElement.TEST));                                                                               
    bg.setCategory(c);
              bg.setDimension(WDBusinessGraphicsDimension.PSEUDO_THREE);
              IWDSimpleSeries ss = (IWDSimpleSeries)view.createElement(IWDSimpleSeries.class,null);
              ss.bindValue(wdContext.nodeDepartments().getNodeInfo().getAttribute(IPrivateSDNUtilityView.IDepartmentsElement.NO_OF_PEOPLE));
              ss.setLabel("Simple Series");
              ss.setLabel("No of People");
              bg.addSeries(ss);
              bg.setChartType(WDBusinessGraphicsType.COLUMNS);
              bg.bindSeriesSource(wdContext.nodeDepartments().getNodeInfo());
              bg.setIgsUrl("http://<hostname>:40080");
    Please help.
    Regards
    Bharathwaj

    Please got through following link
    <a href="/people/sap.user72/blog/2006/05/04/enhancing-tables-in-webdynpro-java-150-custom-built-table-utilities:///people/sap.user72/blog/2006/05/04/enhancing-tables-in-webdynpro-java-150-custom-built-table-utilities

  • Dynamic Creation of Buttons and Actions HELP

    Hi there,
    I have got a problem (or maybe even two) with the dynamic Creation of buttons. The code below creates the buttons.
    My main problem is, that the parameter created for the button's action isn't propagated to the assigned event handler. I get a null, though the name of the parameter in the event handler and the name of the parameter added to the action are the same.
    Could it also be that I'm always using the same action? I.e. does wdThis.wdGetAddElementAction() always return the same action instance? If yes, how can I create individual actions for each button?
    Any help is appreciated!
    Cheers,
    Heiko
    "    for(int i=rootContainer.getChildren().length; i<wdContext.nodeFeature().size();i++)
                   IPrivateVCT_Feature.IFeatureElement featureElement = wdContext.nodeFeature().getFeatureElementAt(i);
                   IWDTray featureTray = (IWDTray) view.createElement(IWDTray.class, featureElement.getName());
                   IWDCaption header = (IWDCaption) view.createElement(IWDCaption.class, featureElement.getName()+"_Header");
                   header.setText(featureElement.getName());
                   featureTray.setHeader(header);
                   featureTray.setExpanded(false);
                   rootContainer.addChild(featureTray);
                   IWDButton button = (IWDButton) view.createElement(IWDButton.class, featureElement.getName()+"_Button_AddElement");
                   IWDAction actionAddElement = wdThis.wdGetAddElementAction();
                   actionAddElement.getActionParameters().addParameter("featureIndex", new Integer(i).toString());
                   button.setOnAction(actionAddElement);
                   button.setText("Add Element");
                   featureTray.addChild(button);

    Hi Heiko,
    You have done everything correctly....except for 1 line
    in the code...
    Replace the following line in your code:
    actionAddElement.getActionParameters().addParameter("featureIndex", new Integer(i).toString());
    Replace the above line with this code:
    button.mappingOfOnAction().addParameter("featureIndex",i);
    Actually in your code, you are not associating the parameter with the button...
    Note that addParameter(...) comes with two signatures: addParameter(String param, String value) and addParameter(String param, int value). You can use any of them based on yuor need.
    Hope it helps,
    Thanks and Regards,
    Vishnu Prasad Hegde

  • DataGrid Control using ActionScript

    Hi,
    Is it possible to generate the rows of a datagrid dynamically
    using actionscript?
    I want to put information of multiple XML's on one line of my
    datagrid.
    Mark

    Ok, I found out my problem, the thing is i wanted to combine
    info in a datagrid, from 2 xml's, but since it's not directly
    possible to access a row of the grid, I created a labelfunction for
    the datagridcolumns which i wanted to populate with a different
    value.
    Source is included below, hope it will help someone.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="1120" height="300" initialize="doInit();">
    <mx:XML id="dataContacts"
    source="/data/Contactperson.xml"/>
    <mx:XML id="dataCommunication"
    source="/data/Communication.xml"/>
    <mx:Script>
    <![CDATA[
    private function doInit():void {
    trace(dataContacts.Contactperson.Firstname);
    protected function getPhonenoById(row:Object,
    column:DataGridColumn):String {
    for each(var node:XML in row.Communicationid) {
    var value:String = new String;
    if (dataCommunication.Communications.Communication.@id ==
    node.toString) {
    value = dataCommunication.Communication.(@id ==
    node.toString()).(@type == "Phone");
    if (value != "") // if the string is empty
    // return to the returning parameter.
    break;
    // returning the value to the cell
    return value;
    ]]>
    </mx:Script>
    <mx:DataGrid x="10" y="10" width="493" id="dg"
    dataProvider="{dataContacts.Contactperson}">
    <mx:columns>
    <mx:DataGridColumn id="dcFirstname" dataField="Firstname"
    headerText="Voornaam"/>
    <mx:DataGridColumn id="dcLastname" dataField="Lastname"
    headerText="Achternaam"/>
    <mx:DataGridColumn id="dcPhone"
    dataField="Communicationid" labelFunction="getPhonenoById"
    headerText="Telefoonnummer"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Canvas>

  • Creation of sale order using bapi in webdynpro using table control

    only first row is getting updated when checked in va03, the line items are not getting replaced, only first row is committed..
    Here is the code for table control i used...
    http://www.scribd.com/doc/51879492/creation-of-sale-order-using-bapi-in-webdynpro-using-table-control
    pls help me out with this..

    Duplicate Posting.  Original is here: Sales order creation with bapi in webdynpro using table control

Maybe you are looking for