5. In the Header Row, insert a new row.
6. We want to create a space in the report header for our Chart. This will serve
as a summary of the sales data before displaying the details. In the top most
part of the header, merge all the cells into one large cell.
Chapter 9
[ 227 ]
7. Insert a Chart element into the large cell. Select Bar Chart as the type. Select
the Stacked Bar Chart as the subtype. Change the Output Format to PNG.
8. Go to the Select Data tab. For the series value, drag in the PriceEach column.
Charts, Hyperlinks, and Drill-Downs
[ 228 ]
9. For the Category (X) Series, use the following expression:
importPackage(java.text);
var dateFormater = new SimpleDateFormat("yyyy-MM");
dateFormater.format(row["ORDERDATE"]);
The above is a BIRT Expression using JavaScript to take the date field and
format it as a YYYY-MM format. This is similar to the formatting we did for
the computed column in the last exercise, except we are using Java objects to
format the date. We will discuss this more in depth in the next chapter.
10. At this point you may get an error depending on the version of BIRT you are
using. If you do not get an error as shown in the following screenshot, skip
to step 13.
Chapter 9
[ 229 ]
11. To fix the error, go to the Format Chart tab. Under Chart Area, expand the
Axis branch and click on the X-Axis item.
Pages:
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182