Difference between revisions of "Java for BlackBerry Tutorial 5"

From Steema Software Reference Wiki
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
 
|- valign="TOP"
 
|- valign="TOP"
 
|
 
|
[[Image:JavaBlackBerryHeaderLogo.png]]
+
[[Image:JavaBlackBerryHeaderLogo.png|200px]]
 
| align="RIGHT" | <font size="2">  [[Java for BlackBerry Tutorials|Contents page]]<br />[[Java for BlackBerry Tutorial 4|Previous]] | [[Java for BlackBerry Tutorial 6|Next]]
 
| align="RIGHT" | <font size="2">  [[Java for BlackBerry Tutorials|Contents page]]<br />[[Java for BlackBerry Tutorial 4|Previous]] | [[Java for BlackBerry Tutorial 6|Next]]
  
Line 13: Line 13:
 
<br>
 
<br>
  
== Tutorial 5 - Legend design ==
+
= Tutorial 5 - Legend design =
  
=== Legend control ===
+
== Legend control ==
  
==== Style ====
+
=== Style ===
  
 
'''Legend Style'''<br />Legend default Style "Automatic" will put Series point values in the Legend when there is only one Series in the Chart. When the Chart contains more than one Series, "Automatic" will put Series names in the Legend. If you change the Legend Style to display values and there is more than one Series in your Chart, TeeChart Pro will display the values of the first Series. You may modify the display using custom options.
 
'''Legend Style'''<br />Legend default Style "Automatic" will put Series point values in the Legend when there is only one Series in the Chart. When the Chart contains more than one Series, "Automatic" will put Series names in the Legend. If you change the Legend Style to display values and there is more than one Series in your Chart, TeeChart Pro will display the values of the first Series. You may modify the display using custom options.
Line 26: Line 26:
 
'''Text Style'''<br />See the TextStyle method for a list of possible Legend text styles. The Text Style formats the Series entry in the Legend (e.g. Showing value as a percentage of total, etc).
 
'''Text Style'''<br />See the TextStyle method for a list of possible Legend text styles. The Text Style formats the Series entry in the Legend (e.g. Showing value as a percentage of total, etc).
  
==== Positioning the Legend (Position tab options) ====
+
=== Positioning the Legend (Position tab options) ===
  
 
'''Alignment'''<br />
 
'''Alignment'''<br />
Line 44: Line 44:
 
  tChart1.getLegend().setLeft(100);
 
  tChart1.getLegend().setLeft(100);
  
==== Number of rows in a horizontal Legend ====
+
=== Number of rows in a horizontal Legend ===
  
 
When the Legend is aligned horizontally (top or bottom), the number of rows can be specified:
 
When the Legend is aligned horizontally (top or bottom), the number of rows can be specified:
Line 54: Line 54:
 
<br />
 
<br />
  
==== Colour box modification ====
+
=== Colour box modification ===
  
 
Use the Colorwidth method to set the width of the colour boxes in the Legend.
 
Use the Colorwidth method to set the width of the colour boxes in the Legend.

Latest revision as of 12:06, 23 June 2014

JavaBlackBerryHeaderLogo.png

Contents page
Previous | Next


Tutorial 5 - Legend design

Legend control

Style

Legend Style
Legend default Style "Automatic" will put Series point values in the Legend when there is only one Series in the Chart. When the Chart contains more than one Series, "Automatic" will put Series names in the Legend. If you change the Legend Style to display values and there is more than one Series in your Chart, TeeChart Pro will display the values of the first Series. You may modify the display using custom options.

 tChart1.getLegend().setLegendStyle(LegendStyles.LASTVALUES);
//Puts the last value of each Series in the Legend box

Text Style
See the TextStyle method for a list of possible Legend text styles. The Text Style formats the Series entry in the Legend (e.g. Showing value as a percentage of total, etc).

Positioning the Legend (Position tab options)

Alignment

There are 4 default positions available using the Alignment method, Top, Bottom, Left and Right. Right is the default position. The default positioning of the Legend will always be outside the Chart.

Resize Chart
The Resize Chart method, when not enabled, will draw the legend within the Chart frame area. Whilst this may be satisfactory for some Legend positioning requirements, better control of Legend positioning in relation to the Chart frame can be achieved by using the Legend HorizMargin and VertMargin properties.

HorizMargin & VertMargin
Horizmargin applies to Left and Right aligned Legends. VertMargin applies to Top and Bottom aligned Legends. Changing the Horizmargin method value will move the Chart frame in relation to the Legend, NOT vice versa. Thus, making a Horizmargin value negative will move the Chart over the Legend (increasing the size of the Chart rectangle area). However, the methods are not intended for repositioning of the Legend over the Chart, to achieve this it is better to use the techniques outlined below.

Custom position
Set the Legend CustomPosition method to true, then set the Top and Left pixel co-ordinates of the Legend to custom position it.

Example

tChart1.getLegend().setCustomPosition(true);
tChart1.getLegend().setTop(100);
tChart1.getLegend().setLeft(100);

Number of rows in a horizontal Legend

When the Legend is aligned horizontally (top or bottom), the number of rows can be specified:

tChart1.getLegend().setMaxNumRows(3);

By default, MaxNumRows is 0 (zero), meaning the Legend will show all values using as many rows as necessary.


Colour box modification

Use the Colorwidth method to set the width of the colour boxes in the Legend.

Example

//move the colour boxes to the right of the value list
tChart1.getLegend().getSymbol().setPosition(LegendSymbolPosition.RIGHT);
//set the boxes as continuous
tChart1.getLegend().getSymbol().setContinuous(true);
//Make the boxes wider
tChart1.getLegend().setColorWidth(40);
//Hide the Pen of the line between the boxes
tChart1.getLegend().getDividingLines().setVisible(false);




PREVIOUS

NEXT


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