This example demonstrates various text styles, text colors, background colors and text box border effects.
In the chart above, 3 different pattern colors (wallpapers) are used for the chart background, legend box background and chart title background. In addition, the chart title, sector labels, and legends all have different fonts, text colors, background colors, and border styles.
- BaseChart.patternColor2 is used to load the wallpaper images and return integers that represent the pattern colors created from the images.
- The pattern colors are then used in BaseChart.setBackground, and also the Box.setBackground methods of the LegendBox object and title TextBox object to set the various background colors.
- The title text and font are specified using BaseChart.addTitle.
- The legend box font is specified using BaseChart.addLegend. It returns a LegendBox object to support further legend box configuration. In this example, the Box.setBackground method of this object is used to set the background color and 3D border effects of the legend box.
- The default sector label font is specified using PieChart.setLabelStyle.
- The sector label font of individual sector is specified using Sector.setLabelStyle.
- The sector label's background color, border color and 3D border effects are specified by first obtaining the TextBox object that represents the sector label using Sector.setLabelStyle, then calling its Box.setBackground method.