Add Element

Comments

1 comment

  • Support Admin

    It is not possible to add XML elements to a qdex module after the module has been published (for example, in scripting).

    You can, however, achieve a similar effect by setting the series attribute in a plot to be larger than the number of series that are initially displayed.

    In the below example, I have two series explicitly defined, but I have set the series attribute to 10. That means that the plot can hold a maximum of 10 series (including the 2 that are initially defined).

    I have created a variable that holds the number of series that are currently plotted. When I press the "Add Series" button this variable increments, and a function is plotted in the next series. I can "add" 8 additional series to my plot in this way. 

    <xyPlot name="myPlot" series="10">
    <series name="firstSeries" />
    <series name="secondSeries" />
    </xyPlot>

    <script>
    local numSeries = 2;

    for x = -100, 100, 1 do
    y = 0.01*math.pow(x,3)
    myPlot.firstSeries:Add(x,y)
    myPlot.secondSeries:Add(x,-y)
    end
    </script>

    <button content="Add Series">
    <onClick>
    numSeries = numSeries + 1
    for x = -20, 20, 0.1 do
    y = numSeries*100*math.sin(x)
    myPlot.Series[numSeries]:Add(x,y)
    end
    </onClick>
    </button>

     

    0
    Comment actions Permalink

Please sign in to leave a comment.