Java for BlackBerry Using the Chart

From Steema Software Reference Wiki
Jump to: navigation, search

JavaAndroidHeaderLogo.gif

Return to main Java page


TeeChart for BlackBerry™

Tutorial: Using the CHART

Steema Software, 2013

Introduction

This tutorial gives developers an overview on how to use the TeeChart Java charting libraries in BlackBerry™. If you’re new to BlackBerry programming please refer first to BlackBerry Java 7.1 SDK Dev Guide: https://developer.blackberry.com/java/documentation/intro_1968201_11.html

Creating a Chart

Using TeeChart, you can add charts & graphs to your BlackBerry Applications in the following ways: 1. Linking your application to TeeChart for BlackBerry Java library (JAR) or Java source code.

1. Linking TeeChart JAR or sources TeeChart for BlackBerry library can be obtained from Steema.com website, either as a trial or licensed version. Simply add the JAR library to your project (for example using Eclipse IDE accessing your project Properties, Java Build Path, Libraries, Add External JARs) or TeeChart source code (Properies, Java Build Path, Source). Now you can refer to TeeChart class namespaces to for example create a new TChart View programatically and add it to your desired Layout: TChart chart;

   	/**
    	* Creates a new MyScreen object
    	*/
   	public MyScreen()
   	{        
   	    // Set the displayed title of the screen       
   	    setTitle("MyTitle");
   	    chart = new TChart();
   	    this.add(chart);
   	    chart.addSeries(new com.steema.teechart.styles.Area());
   	    chart.getSeries(0).fillSampleValues();
 	  }


Adding data to your chart can be done in several ways, for example manually:

Pie myPie = new Pie();
chart.addSeries( myPie );

myPie.add( 123, "Apples" ); myPie.add( 456, "Kiwis" );


For a complete reference of classes, properties and methods please follow this link: http://www.steema.us/files/public/teechart/java/v3/blackberry/doc Once the application is created, to be able to execute it in the simulator or a device, use the TeeChartBlackBerry.cod file which is included in the installer.

Charting styles and features

Using the Intent, series formatting and data should be passed using the Intent "extras" methods, with some of the following non case-sensitive keys:

Key Values Example
Header
Footer
SubHeader
SubFooter
string
intent.putExtra("Header", "Hello World !");
intent.putExtra("Footer", "My Fruits");
Style Line, Points, Area, FastLine, HorizLine, Bar, HorizBar,Pie, Shape, Arrow, Bubble, Gantt, Candle, Donut, Volume, Bar3D, Points3D, Polar, Radar, Clock, WindRose, Pyramid, Surface, LinePoint, BarJoin, ColorGrid, Waterfall, Histogram, Error, ErrorBar, Contour, Smith, Calendar, HighLow, TriSurface, Funnel, Box, HorizBox, HorizArea, Tower, PointFigure, Gauges, Vector3D, Map, Bezier, ImageBar, IsoSurface, CircularGauge, LinearGauge,

VerticalLinearGauge, HorizHistogram

intent.putExtra("Style", "Bar");

or…

Bundle b = new Bundle();
b.putInt("Color", 255);
intent.putExtra("Series1", b);
Marks boolean
intent.putBoolean("Marks", true);
Legend boolean
intent.putBoolean("Legend", false);
Width
Height
integer
intent.putInt("Width", 250);
SeriesX Series1, Series2, …
Bundle b = new Bundle();
intent.putExtra("Series4", b);

"TeeChart for BlackBerry © 2013 by Steema Software. All Rights Reserved."

Many thanks to Pep Jorge at Steema Software for this article!


© 1998-2014 Steema Software SL. All rights reserved.