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 SugarCRM database and the following query: |
select * from orders
Click Next.
| 2. | Move all the fields into the right box. Click Next and Finish. |
| 3. | Delete all bands except for Title and Summary. |
| 4. | 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. | Right-click the chart and select Chart Properties > Chart Data > Configuration. |
Configuration for Chart Data |
|
| 3. | Create a Category with the following: |
| • | Expression: $F{SHIPCOUNTRY} |
| • | Value Class Name: java.lang.String |
Click OK.
| 4. | Create a Series with the following: |
| • | Expression: newjava.text.SimpleDateFormat ("yyyy").format( $F{ORDERDATE} ) |
| • | Value Class Name: java.lang.Comparable |
Click OK.
| 5. | Add a Measure for freight values: |
| • | Label Expression: "Freight" |
| • | Value Expression: $F{FREIGHT} |
| • | Value Class Name: java.lang.Integer |
Do not click OK yet. The next step shows how to specify that this measure should be used for columns.
| 6. | Go to Advanced Properties for the measure you just created and click Add to specify the series type. |
Edit Advanced Properties for Freight Values |
|
| 7. | Enter the following values. The support constant values are column, line, and spline: |
| • | Contributor: SeriesProperty |
| • | Use Constant Value: column |
Click OK, then click OK again.
| 8. | Add a second Measure for orders: |
| • | Label Expression: “Total Orders” |
| • | Calculation: DistinctCount |
| • | Value Expression: $F{ORDERID} |
| • | Value Class Name: java.lang.Integer |
Do not click OK yet. The next step shows how to specify that this measure should be used for the spline.
| 9. | Go to Advanced Properties for the measure you just created and click Add to specify the series type (available options are column, line, and spline): |
| • | Contributor: SeriesProperty |
| • | Use Constant Value: spline |
Click OK, then click OK again.
| 10. | To see fewer countries in your chart, select Edit Chart Properties > Chart Data > Dataset. |
| 11. | Add an Increment expression such as: |
$F{SHIPCOUNTRY}.startsWith("A") ||
$F{SHIPCOUNTRY}.startsWith ("U") ||
$F{SHIPCOUNTRY}.startsWith ("I")
Click OK.
| 12. | 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. |
| d. | Arrange the Items Layout to be Horizontal. |
| 13. | Save and preview your report. It should look like the following figure. |
Column Spline Chart |
|
Recommended Comments
There are no comments to display.