Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

New Contributor
Posts: 2
Registered: ‎11-14-2012
My Device: bold 9900
My Carrier: att

2d chart approach

I need to draw a simple 2d line chart with x and y-axis but I am not sure what is the best approach.

For input, the application will have a set of data points (i.e: (3,4),(1,2), etc...) so it would be an acceptable solution to 

just draw an image that contains the drawn out line chart.


Please advise,

Thank you!

BlackBerry Development Advisor
Posts: 143
Registered: ‎03-08-2012
My Device: Z10
My Carrier: Bell

Re: 2d chart approach



There are two approaches you can use here.  the IDE documentation has a chapter that talks about how to use OpenGL for 2D rendering.  In the case of drawing lines, you would do that with glDrawArray.  Other functions are available in GL ES 1.1 and 2.0 for drawing filled triangles as well.  OpenGL experience would be an asset here as higher level calls for doing some of these operations are not available.


If you were looking for a higher level API, you can try out the Skia 2D library.  A port of the library is available for BlackBerry 10 on our GitHub site.  IF you go to the native microsite and look at the graphics libraries page(http://developer.blackberry.com/native/beta/documentation/graphics.html), you can find a link to it near the bottom of the page.  Using that library requires building it from the source and then copying the headers and generated libraries to your app project in order to call it in your code.