B4A Library GraphView Library (Source Code Added)

The so much awaited time is here, I have finally Updated the GraphView Library, there are some majors updates as the main jar file has been upgraded by the original author of this library.
This library is now complete, all methods and functions have been wrapped, although i have not fully tested it myself. I'am providing a small example to show some of the new features this library offers.

Note:
This library requires the AppCompat library done by Corwin42, thanks to him for this great library and it can be downloaded from here
AppCompat


Line Series
BarGraph Series
Points Series

Source Code has been added for whoever wants to continue maintaining this library as I no longer have the time to do it.
I had to do a lot of digging to find the source code but here it is, it can be downloaded from the following link.

https://drive.google.com/open?id=1NyFzI5SvKsDA3wDNC8K5ksFKpb61SI5L

  • With this new version you can use as many series as you wish (have not tested with more than 5 series)
  • The option to use Dates in the X axis is now also available.
  • This library allows you to have 2 Y Axis, it also includes a click listener for any Series you provide, you can click on any data point on the series and either show a toast message or log the data.
  • Custom Label Formatter
  • Change all Axis Text color and Text size
  • Change Graph's Title color and Text size
  • Live Graph
  • Change Points series to Circular, Square and Triangle
  • Display Data Point values on top of Bar graph series
  • Change the legend's physical position (Top, Middle, Bottom)
  • Many other options.......
B4AGraphView
Version:
1.35
  • LineSeries
    Events:
    • SeriesClicked (xdata as String As , ydata as String As )
    Methods:
    • AppendData (x As Double, y As Double, viewportsize As Int)
      Appends data to an already existing series, used to plot live Data, and sets the viewport size
      Example
      <code>
      series.AppendData(x, y, 100)
      </code>
    • DataPointRadius (series As LineGraphSeries, size As Int)
      Sets the line series data Point radius
      Example
      <code>
      series.DataPointRadius(series, 10)
      </code>
    • DrawBackGroundColor (color As Int)
      Sets the line series background color / the background color for the filling under the line.
      Example
      <code>
      series.DrawBackGroundColor(colors.LightGray)
      </code>
    • Initialize (eventName As String, title As String, color As Int, Dates As Boolean, xdata() As Double, ydata() As Double) As LineGraphSeries
    • IsInitialized As Boolean
    • ResetData (x() As Double, y() As Double) As DataPoint[]
      Resets the x, and y axis data
      <B>NOTE: Use only in Sub Activity_Resume
      before appending any data to a series.</B>
      Example
      <code>
      series.ResetData(xx, yy)
      </code>
    • ShowDotDataPoints
      Enables the DataPoints to be shown on the Line Series
      Example
      <code>
      series.ShowDotDataPoints
      </code>
    • ShowDottedLine (linecolor As Int, strokewidth As Int)
      Changes the Line Series to a dotted line, sets the color and the stroke width
      Example
      <code>
      series.ShowDottedLine(colors.Black, 15)
      </code>
  • PointGraphSeries
    Events:
    • SeriesClicked (xdata as String As , ydata as String As )
    Methods:
    • Initialize (eventName As String, title As String, color As Int, Dates As Boolean, xdata() As Double, ydata() As Double) As PointsGraphSeries
    • IsInitialized As Boolean
    • SetPointShape
      Changes the Points Shape to round shape
      Example
      <code>
      dim pointseries as PointGraphSeries
      pointseries.Initialize("pointseries", "Points Series", colors.Blue, False, xx, yy)
      pointseries.SetPointShape
      </code>
    • SetRectangleShape
      Changes the points Shape to Rectangle shape
      Example
      <code>
      dim pointseries as PointGraphSeries
      pointseries.Initialize("pointseries", "Points Series", colors.Blue, False, xx, yy)
      pointseries.SetrectangleShape
      </code>
    • SetTriangleShape
      Changes the points Shape to Triangle Shape
      Example
      <code>
      dim pointseries as PointGraphSeries
      pointseries.Initialize("pointseries", "Points Series", colors.Blue, False, xx, yy)
      pointseries.SetTriangleShape
      </code>
  • bargraphseries
    Events:
    • SeriesClicked (xdata as String As , ydata as String As )
    Methods:
    • BarSeriesSpacing (series As BarGraphSeries, spacing As Int)
      Sets the Bar Series spacing
      Example
      <code>
      dim barseries as bargraphseries
      barseries.Initialize("barseries", "Bar Series", colors.Blue, False, xx, yy)
      barseries.BarSeriesSpacing(50)
      </code>
    • Initialize (eventName As String, title As String, color As Int, Dates As Boolean, xdata() As Double, ydata() As Double) As BarGraphSeries
    • IsInitialized As Boolean
    • showBarValues (series As BarGraphSeries, color As Int)
      Enables the Y axis values on top of the Bar series and sets the text color
      Example
      <code>
      dim barseries as bargraphseries
      barseries.Initialize("barseries", "Bar Series", colors.Blue, False, xx, yy)
      barseries.showBarValues(barseries, colors.Green)
      </code>
  • graph
    Methods:
    • AddBarSeries (Dates As Boolean, SecondScale As Boolean, series() As Bargraphseries) As GraphView
      Adds BarSeries to the graphview, it takes a boolean if using dates, a boolean if assigning the series to the second Y scale
      Example
      <code>
      dim barseries as bargraphseries
      dim xx(10) as double
      dim yy(10) as double
      for i = 0 to xx.lenght -1
      xx(i) = i
      yy(i) = i
      next
      barseries.Initialize("barseries", "Glucose Levels", Colors.Green, False, xx, yy)
      graphview.AddBarseries(False, False, Array as bargraphseries(barseries))
      </code>
    • AddLineSeries (Dates As Boolean, SecondScale As Boolean, series() As Lineseries) As GraphView
      Adds series lines to the graphview, it takes a boolean if using dates, a boolean if assigning the series to the second Y scale
      Example
      <code>
      dim series as lineseries
      dim xx(10) as double
      dim yy(10) as double
      for i = 0 to xx.lenght -1
      xx(i) = i
      yy(i) = i
      next
      series.Initialize("series", "Glucose Levels", Colors.Blue, False, xx, yy)
      graphview.AddLineSeries(False, False, Array as lineseries(series))
      </code>
    • AddPointsSeries (Dates As Boolean, SecondScale As Boolean, series() As Pointgraphseries) As GraphView
      Adds PointSeries to the graphview, it takes a boolean if using dates, a boolean if assigning the series to the second Y scale
      Example
      <code>
      dim pointseries as pointseries
      dim xx(10) as double
      dim yy(10) as double
      for i = 0 to xx.lenght -1
      xx(i) = i
      yy(i) = i
      next
      pointseries.Initialize("pointseries", "Glucose Levels", Colors.Red, False, xx, yy)
      graphview.AddPointSeries(False, False, Array as pointgraphseries(pointseries))
      </code>
    • FormatLabels (FractionDigits As Int, IntegerDigits As Int)
      Format horizontal and vertical labels
      Set number of fraction digits
      Set number of Integer digits
      Example
      <code
      >graphview.FormatLabels(2, 3)
      </code>
    • HorizontalLabelColor (color As Int)
      Sets the Horizontal scale label's text color
      Example
      <code>
      graphview.HorizontalLabelColor(colors.Blue)
      </code>
    • Initialize (title As String, Dates as Boolean) As GraphView
    • IsInitialized As Boolean
    • SetBackGroundColor (color As Int)
      Sets the grids background color
      <B>NOTE: There is an issue using this function when using two Y axis
      Only use it if one Y Axis is being used.</B>
      Example
      <code>
      graphview.SetBackGroundColor(colors.LightGray)
      </code>
    • SetCustomLabel (sign As String)
      Set custom labels on graphview
      Example
      <code>
      graphview.SetCustomLabel("$")
      </code>
    • SetGraphTitleColor (color As Int)
      Sets the Graph's Title color
      Example
      <code>
      graphview.SetGraphTitleColor(colors.Blue)
      </code>
    • SetGraphTitleSize (size As Int)
      Sets the Graph's Title size
      Example
      <code>
      graphview.SetGraphTitleSize(50)
      </code>
    • SetGraphViewTextSize (size As Float)
      Sets the Horizontal, Vertical and Second Vertical Text size
      Example
      <code>
      graphview.SetGraphViewTextSize(45)
      </code>
    • SetGridStyletoBoth
      Sets the graph's grid style to both Horizontal and Vertical
      Example
      <code>
      graphview.SetGridStyletoBoth
      </code>
    • SetGridStyletoHorizontal
      Sets the graph's grid style to Horizontal only (only Horizontal line)
      Example
      <code>
      graphview.SetGridStyltoHorizontal
      </code>
    • SetGridStyletoNone
      Sets the graph's grid style to None (No horizontal or vertical lines)
      Example
      <code>
      graphview.SetGridStyletoNone
      </code>
    • SetGridStyletoVertical
      Sets the graph's grid style to Vertical only (only Vertical Line)
      Example
      <code>
      graphview.SetGridStyletoVertical
      </code>
    • SetHorizontalAxisTitle (title As String, color As Int)
      Sets the Horizontal Axis Title and Color
      Example
      <code>
      graphview.SetHorizontalAxisTitle("Time(s)", colors.Blue)
      </code>
    • SetLegendAlignBottom
      Sets the graph's Legend physical Position to the bottom
      Example
      <code>
      graphview.SetLegendAlignBottom
      </code>
    • SetLegendAlignMiddle
      Sets the graph's Legend physical Position to the middle
      Example
      <code>
      graphview.SetLegendAlighMiddle
      </code>
    • SetLegendAlignTop
      Sets the graph's Legend physical position to the top
      Example
      <code>
      graphview.SetLegendAlignTop
      </code>
    • SetLegendBackGroundColor (color As Int)
      Sets the Legend's background color
      Example
      <code>
      graphview.SetLegendBackGroundColor(colors.LightGray)
      </code>
    • SetLegendMargin (margin As Int)
      Sets the Legend's margin / margin from the edge of the box to the corner of the graphview
      Example
      <code>
      graphview.SetLegendMargin(10)
      </code>
    • SetLegendPadding (padding As Int)
      Sets the Legend's padding / padding is the space between the edge of the box and the beginning of the text
      Example
      <code>
      graphview.SetLegendPadding(20)
      </code>
    • SetLegendSpacing (spacing As Int)
      Sets the Legend's spacing / set the spacing between the text lines
      Example
      <code>
      graphview.SetLegendSpacing(5)
      </code>
    • SetLegendTextColor (color As Int)
      Sets the text color of the legend labels.
      Example
      <code>
      graphview.SetLegendTextColor(colors.LightGray)
      </code>
    • SetLegendTextSize (textSize As Float)
      Sets the graph's Legend's Text Size
      Example
      <code>
      graphview.SetLegendTextszie(40)
      </code>
    • SetLegendWidth (width As Int)
      Sets the graph's Legend Width
      Example
      <code>
      graphview.SetLegendWidth(100)
      </code>
    • SetSecondYScaleColor (color As Int)
      Sets the Second Y Scale label's color
      Example
      <code>
      graphview.SetSecondYScaleColor(colors.Brown)
      </code>
    • SetVerticalAxisTitle (title As String, color As Int)
      Sets the Veritcal's Axis Title and Color
      Example
      <code>
      graphview.SetVerticalAxisTitle("Force(lbs)", colors.Red)
      </code>
    • VerticalLabelColor (color As Int)
      Sets the Vertical scale label's text color
      Example
      <code>
      graphview.VerticalLabelColor(colors.Magenta")
      </code>


Hope you guys find this useful, compared to other methods found here in the forum i find this way easier to use, as it only requires a few lines of code.
Please feel free to post your comments, recommendations and feedback.

The Example i've put together can be downloaded from here:

GraphView Example

:Updated April 3rd, 2015

Complete library based on the new original jar file.
 

Attachments

  • B4AGraphView_V1.35.zip
    78 KB · Views: 1,088
  • Screenshot_2015-04-01-21-38-58.png
    Screenshot_2015-04-01-21-38-58.png
    167.9 KB · Views: 1,410
Last edited:

Michael Gasperi

Member
Licensed User
Longtime User
I too make good use of this library. However, seems that I only find the 1.0 version for download at the top of this thread. I thought I looked in all the places where library files are usually kept, but XYGraph doesn't seem to be there. Where does it live or am I blind and don't see it?
 

walterf25

Expert
Licensed User
Longtime User
I too make good use of this library. However, seems that I only find the 1.0 version for download at the top of this thread. I thought I looked in all the places where library files are usually kept, but XYGraph doesn't seem to be there. Where does it live or am I blind and don't see it?
You can download it from here, it is in the first post.
 

walterf25

Expert
Licensed User
Longtime User
The library has been updated, you can now add 3 different series to the graph, the live graph view also supports 3 different series, i've also updated the example and have commented the code so you can follow it. I will try to update the library again and implement as many series as you want within the capability of the original library. I'll do that as soon as i get some time.

Enjoy!
 

wimpie3

Well-Known Member
Licensed User
Longtime User
Thanks, great news!

Will you add
- setCustomLabelFormatter
- drawBackground
- setDrawDataPoints

as well please? This is something I've been waiting for a long time...
 

walterf25

Expert
Licensed User
Longtime User
Thanks, great news!

Will you add
- setCustomLabelFormatter
- drawBackground
- setDrawDataPoints

as well please? This is something I've been waiting for a long time...
I'll try to add those methods as soon as i get some free time.
 

ValDog

Active Member
Licensed User
Longtime User
I've been working with your example code, specifically the SimpleGraph example, trying to display the graph in a Panel. The graph displays just fine, but the associated x and y axis value labels do not show. Has anyone been able to do this?
 

walterf25

Expert
Licensed User
Longtime User
I've been working with your example code, specifically the SimpleGraph example, trying to display the graph in a Panel. The graph displays just fine, but the associated x and y axis value labels do not show. Has anyone been able to do this?
Can you post your project?
 

ValDog

Active Member
Licensed User
Longtime User
Here it is...

Could not upload the entire file - too large?? So, here is the pertinent code applied to your example SimpleGraph.bas:

Sub Globals
Dim simpleseries As graphseries
Dim simplegraph As graphview
Dim XYGraph As XYGraph
Dim y(100) As Double
Dim sinewave As Double
Dim view1 As View

Private pnlGraphing As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("graphing")

For i = 0 To y.Length -1
sinewave = sinewave + 0.2
y(i) = Sin(sinewave)
Next

simpleseries.Initialize("SimpleSeries", Colors.Cyan, y, 3)
simplegraph.Initialize("line", simpleseries)
view1 = XYGraph.PlotSingleLine("Simple Graph Example", simplegraph, simpleseries)
XYGraph.Legend(simplegraph, True)
XYGraph.setScalable(simplegraph, True)
XYGraph.setViewPort(simplegraph, 1, 49)
XYGraph.setScrollabe(simplegraph, True)
XYGraph.setLegendWidth(simplegraph, 300)
XYGraph.setTextSize(simplegraph,20)

' Activity.AddView(view1, 0, 0, 90%x, 90%y)
pnlGraphing.AddView(view1, 50, 90, pnlGraphing.Width * .75, pnlGraphing.Height * .75)

End Sub


Note that I added a panel in a new activity, "graphing", named pnlGraphing - and modified Manifest to display this new activity in "portrait" mode.
 

walterf25

Expert
Licensed User
Longtime User
Here it is...

Could not upload the entire file - too large?? So, here is the pertinent code applied to your example SimpleGraph.bas:

Sub Globals
Dim simpleseries As graphseries
Dim simplegraph As graphview
Dim XYGraph As XYGraph
Dim y(100) As Double
Dim sinewave As Double
Dim view1 As View

Private pnlGraphing As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("graphing")

For i = 0 To y.Length -1
sinewave = sinewave + 0.2
y(i) = Sin(sinewave)
Next

simpleseries.Initialize("SimpleSeries", Colors.Cyan, y, 3)
simplegraph.Initialize("line", simpleseries)
view1 = XYGraph.PlotSingleLine("Simple Graph Example", simplegraph, simpleseries)
XYGraph.Legend(simplegraph, True)
XYGraph.setScalable(simplegraph, True)
XYGraph.setViewPort(simplegraph, 1, 49)
XYGraph.setScrollabe(simplegraph, True)
XYGraph.setLegendWidth(simplegraph, 300)
XYGraph.setTextSize(simplegraph,20)

' Activity.AddView(view1, 0, 0, 90%x, 90%y)
pnlGraphing.AddView(view1, 50, 90, pnlGraphing.Width * .75, pnlGraphing.Height * .75)

End Sub


Note that I added a panel in a new activity, "graphing", named pnlGraphing - and modified Manifest to display this new activity in "portrait" mode.
I don't see the problem you are saying, i just tried it again this time by adding the graph to a panel and it works just fine, see the image attached.

https://www.dropbox.com/s/ipr3vhuy06rahkx/graph_screenshot.png

Cheers,
Walter
 

ValDog

Active Member
Licensed User
Longtime User
Has anyone noticed that this library does not play nice with Debug (rapid)? Even a trivial change to code, say adding a blank line line in the code, results in a crash with a message like:

** Activity (main) Pause, UserClosed = false **
** Activity (specview) Create, isFirst = false **

Error occurred on line: 39 (specview)
java.lang.RuntimeException: Object should first be initialized (graphview).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:46)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:302)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
at b4a.gsight.specview.afterFirstLayout(specview.java:98)
at b4a.gsight.specview.access$100(specview.java:16)
at b4a.gsight.specview$WaitForLayout.run(specview.java:76)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)


The subject code line (39) reads:

view1 = XYGrapha.PlotSingleLine("Spectrum", simplegraphview, specseries)

And of course the line just above (38) has already initialized "simplegraphview":

simplegraphview.Initialize("line", specseries)



Under Debug (legacy) it seems to work just fine. Anyone else experiencing this or is it just me?
 

walterf25

Expert
Licensed User
Longtime User
Has anyone noticed that this library does not play nice with Debug (rapid)? Even a trivial change to code, say adding a blank line line in the code, results in a crash with a message like:

** Activity (main) Pause, UserClosed = false **
** Activity (specview) Create, isFirst = false **

Error occurred on line: 39 (specview)
java.lang.RuntimeException: Object should first be initialized (graphview).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:46)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:302)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
at b4a.gsight.specview.afterFirstLayout(specview.java:98)
at b4a.gsight.specview.access$100(specview.java:16)
at b4a.gsight.specview$WaitForLayout.run(specview.java:76)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)


The subject code line (39) reads:

view1 = XYGrapha.PlotSingleLine("Spectrum", simplegraphview, specseries)

And of course the line just above (38) has already initialized "simplegraphview":

simplegraphview.Initialize("line", specseries)



Under Debug (legacy) it seems to work just fine. Anyone else experiencing this or is it just me?
As far as i Know, a lot of the custom made libraries don't work well with the rapid debugger.
 

ValDog

Active Member
Licensed User
Longtime User

Attachments

  • XYGraph ExampleVM.zip
    8.3 KB · Views: 396

walterf25

Expert
Licensed User
Longtime User
Walter, this is strange - I figured out why my code download was too big - see my uploaded code and try it again - thanks!
Hi the problem is that you are setting the color of your panel to white, and the color of the x and y text is also white, so you can't see the text obviously.

You can either change the color of the panel to black or some other color, or you can change the color of the x and y labels

B4X:
    XYGraph.setHorizontalLabelColor(simplegraph, Colors.Black)
    XYGraph.setVerticalLabelColor(simplegraph, Colors.Black)
 

ValDog

Active Member
Licensed User
Longtime User
Walter, do you have any ideas on just how one would create a display with a logarithmic y scale using this library?

Secondly, the display x axis values are just a reflection of the number of y data points. In fact they can also represent other values, for instance in my application I display the number of counts collected in each of 510 energy bins. Now, those energy bins correlate to energy values - so ideally I would like to be able to display an x axis value that equals the bin number multiplied by some factor. Any thoughts?
 

ValDog

Active Member
Licensed User
Longtime User
Walter, got another one for you...

This is from your MultipleLineGraph example code:

Sub Globals
Dim series1, series2 As graphseries
Dim multiplegraphview As graphview
Dim xymultiplegraph As XYGraph
Dim data1(100) As Double
Dim data2(100) As Double
Dim sinewave As Double
Dim cosinewave As Double
Dim view1 As View
End Sub

Sub Activity_Create(FirstTime As Boolean)
For i = 0 To data1.Length - 1
sinewave = sinewave + 0.2
data1(i) = Sin(sinewave)
Next

For i = 0 To data2.Length - 1
cosinewave = cosinewave + 0.2
data2(i) = Cos(cosinewave)
Next

series1.Initialize("Sine Curve Series", Colors.Red, data1, 3)
series2.Initialize("Cosine Curve Series", Colors.Blue, data2, 3)
multiplegraphview.InitializeMultipleGraph("line", series1, series2, Null)

view1 = xymultiplegraph.PlotMultipleLines("Multiple Line Graph", multiplegraphview, series1, series2, Null)

xymultiplegraph.setScrollabe(multiplegraphview, True)
xymultiplegraph.setViewPort(multiplegraphview, 1, 99)
xymultiplegraph.Legend(multiplegraphview, True)
xymultiplegraph.setLegendAlign(multiplegraphview, "bottom")
xymultiplegraph.setLegendWidth(multiplegraphview, 300)

Activity.AddView(view1, 0, 0, 100%x, 100%y)
End Sub


When I Test Compilation I get no errors, but when I run it I crash on the "view1 = xymultiplegraph...." statement above with a NullPointerException. ??
 

walterf25

Expert
Licensed User
Longtime User
Walter, got another one for you...

This is from your MultipleLineGraph example code:

Sub Globals
Dim series1, series2 As graphseries
Dim multiplegraphview As graphview
Dim xymultiplegraph As XYGraph
Dim data1(100) As Double
Dim data2(100) As Double
Dim sinewave As Double
Dim cosinewave As Double
Dim view1 As View
End Sub

Sub Activity_Create(FirstTime As Boolean)
For i = 0 To data1.Length - 1
sinewave = sinewave + 0.2
data1(i) = Sin(sinewave)
Next

For i = 0 To data2.Length - 1
cosinewave = cosinewave + 0.2
data2(i) = Cos(cosinewave)
Next

series1.Initialize("Sine Curve Series", Colors.Red, data1, 3)
series2.Initialize("Cosine Curve Series", Colors.Blue, data2, 3)
multiplegraphview.InitializeMultipleGraph("line", series1, series2, Null)

view1 = xymultiplegraph.PlotMultipleLines("Multiple Line Graph", multiplegraphview, series1, series2, Null)

xymultiplegraph.setScrollabe(multiplegraphview, True)
xymultiplegraph.setViewPort(multiplegraphview, 1, 99)
xymultiplegraph.Legend(multiplegraphview, True)
xymultiplegraph.setLegendAlign(multiplegraphview, "bottom")
xymultiplegraph.setLegendWidth(multiplegraphview, 300)

Activity.AddView(view1, 0, 0, 100%x, 100%y)
End Sub


When I Test Compilation I get no errors, but when I run it I crash on the "view1 = xymultiplegraph...." statement above with a NullPointerException. ??
Hi, i just checked and yes it looks like a bug, i don't check for any exception in my library in case you only want to use 2 series, what you can do for the meantime is set the data for series3 to 0 and also set the color of series3 to colors.transparent, that way it will not show up in your graph.

I will try to fix this as soon as i get a chance.

Thanks,
Walter
 
Top