none
Basic Plotting Extension RRS feed

  • General discussion

  •  

    Here is a plotting extension that creates a plot control with data, displayed inside the SmallBasic GraphicsWindow.

    Due to effort maintaining multiple simple extensions, all the extensions I work with are now combined into one extension and can be downloaded here (+ C# source).

    The created control can be moved, rotated, zoomed, removed etc using the standard SmallBasic Shapes methods, i.e. it is just another shape object like images, controls and basic shapes (rectangle, ellipse etc). Therefore you can have more than one plot at once, hide and show them - everything you can do with any other shape.

    Currently there are only 3 main methods, LDGraph.AddGraph (create a graph object with dimensions and axes titles) and LDGraph.AddSeries and LDGraph.DeleteSeries (send an array of data to be plotted).  Since SB allows non-integer array indexing, the X axis value is the index value and the Y axis value is the array value.

    Movable legend, zooming and export data to Excel added with right click.

    See example below and my test sample here JZS160 or this simple example JLZ973.

    gw = 600
    gh = 600
    GraphicsWindow.Width = gw
    GraphicsWindow.Height = gh

     For i = 0 To 1000
    x = i/10
    y = x*Math.Sin(x)
    data[x] = y
    EndFor

    graph = LDGraph.AddGraph(10,10,gw-20,gh-20,"Modified Sine Wave","X (Radians)","X x Sin(X)")
    LDGraph.AddSeries(graph,"Plot 1",data,"Red")



    Monday, December 19, 2011 11:22 PM
    Moderator

All replies

  • Fixing bug


    Ed Price (a.k.a User Ed), SQL Server Customer Program Manager (Blog, Twitter, Wiki)

    Tuesday, October 23, 2012 12:41 AM
    Owner
  • Nice extension! Are the Office Interop COM libraries necessary for the export to Excel?

    Please mark any answers and "vote as helpful" any posts that help you!


    • Edited by gungan37Editor Tuesday, October 23, 2012 12:56 AM Typographical error
    Tuesday, October 23, 2012 12:56 AM
    Answerer