Dual-Axis, Multi-Axis, and Combination Charts

Dual- and multi-axis charts are useful when you want to plot multiple chart types on the same chart or use two different scales for each y-axis. This enables you to easily compare data items with very different scales.

Similarly, combination charts are used to display multiple data series in a single chart that combines the features of two different charts.

In this example, we create a column spline chart that plots freight and orders per country, per year.

To create the report for the chart:

1. Open a new, blank report using the Sugar CRM database and the following query:

select * from orders

Click Next.

2. Move all the fields into the right-hand box. Click Next.
3. No need to group by any field. Click Finish.
4. Right-click on each band in the outline view, and choose Delete to delete all bands except for Title and Summary.
5. Enlarge the Summary band to 500 pixels by changing the Height entry in the Band Properties view.

To create the chart:

1. Drag the HTML5 Charts element into the summary band, and select ColumnSpline.
2. In HTML5 Chart Properties > Chart Properties > Chart Data > Configuration create a Category with the following:
     Name: Country
     Expression: $F{shipcountry}
     Value Class Name: java.lang.String
     Order: None

Click OK.

3. Create a Series with the following:
     Name: Year
     Expression: new java.text.SimpleDateFormat ("yyyy").format( $F{orderdate} )
     Value Class Name: java.lang.Comparable
     Order: Ascending

Click OK.

4. Add a Measure for freight:
     Name: Freight Values
     Label Expression: “Freight”
     Calculation: Count
     Value Expression: ${freight}
     Value Class Name: java.lang.integer

Click OK.

5. Add a second Measure for orders:
     Name: Total Orders
     Label Expression: “Total Orders”
     Calculation: DistinctCount
     Value Expression: $F{orderid}
     Value Class Name: java.lang.integer

Click OK.

6. To see fewer countries in your chart, select Edit Chart Properties > Chart Data > Dataset.
7. Add a Filter expression such as:

$F{shipcountry}.startsWith("A") ||

$F{shipcountry}.startsWith ("U") ||

$F{shipcountry}.startsWith ("I")

Click OK.

8. To change the position or layout of the legend:

Legend Properties

a. Go to Chart Properties > Chart Properties.
b. Click the down arrow next to Legend on the left.
c. Highlight Items.
d. Arrange the Items Layout to be Horizontal.
e. Click OK.
9. Save and preview your report. It should look like the following:

Column Spline Chart

Version: 
Feedback