WHAT'S HOT
Prev | Current Page 143 | Next

LordAlex Leon, Greg Goralski

"Foundation Flex for Designers"

We need to put
more than one of the values from our DataGrid into each label, specifically the students??™ names and
their averages (right now it is just the averages). We do this by creating a function that controls what is
seen in the label. Figure 10-35 shows the ActionScript label function showStudent, which overrides the
existing label and gives it the name of the student, a space, the average, and the percent symbol.
211
EXPLORING FLEX CHARTING
Figure 10-35. ShowStudent label function
4. To add this function to the pie chart, add labelFunction="showStudent" to the PieSeries
MXML (Figure 10-36).
Figure 10-36. Pie chart MXML with the ShowStudent label function
Looking at our pie chart now, you can see that it is a good deal clearer (Figure 10-37).
Figure 10-37. Pie chart with informative labels
212
CHAPTER 10
5. The pie chart gives us an opportunity to try another form of chart customization. We can modify
the colors, and what??™s more we can make them gradients, in the MXML. We??™ll add a series of gradients
inside a fill tag, as shown in Figure 10-38. Add this code after the tag.
Figure 10-38. Pie chart MXML with gradients
This is a very code-centric way of designing, but it does give a good effect (Figure 10-39). In this example,
the first gradient entry defines the inner color and the second defines the outside color.
213
EXPLORING FLEX CHARTING
Figure 10-39. Pie chart with gradients
Adding a second set of data
To see the transitional effects more dramatically, we have added a second XML file with more data.


Pages:
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
pa%C5%84stwa Firmy chińskie pomorskie Firmy chińskie łódźkie długopisy reklamowe ATB