5.6.8 TextMarker

TextMarker is a rectangle with text. Its position can be set anywhere on chart.

Setting TextMarker:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Setting TextMarker 
TextMarker textMarker = new TextMarker("Average High Temp. 7.0\u00B0C\n"
  + "Daily Mean Temp. 2.4\u00B0C\n"
  + "Average Low Temp. -2.3\u00B0C\n"
  + "Precipation Total 442mm", axisX, axisY);
 
// Setting where text marker should stand
textMarker.setPosition("Jan",75d);
 
// setting background color
textMarker.getPaintStyle().setBackground(new Color(62, 62, 62).brighter());
 
// setting text's font
textMarker.getTextStyle().setFont(new Font("tahoma", Font.BOLD, 10));
 
// setting text's color
textMarker.getTextStyle().setColor(Color.WHITE);
 
// setting where text should stand
textMarker.setAlignment(Alignment.RIGHT, Alignment.BOTTOM);
textMarker.getPaintStyle().setTransparencyValue(225);

TextMarker Demonstration

Figure 5.6.8.1 TextMarker Demonstration

View Source