Scatter charts plot two or more data series as points. The charts are intended to show raw data distribution of the series. The data is represented as follows:
|
1.
|
The first data series is represented as the x values. |
|
2.
|
The second data series is represented as correlated y values. |
|
3.
|
Any additional data series are plotted as y values correlated to the x values provided by the first series. |
As a result, a scatter chart always displays one less plot than the number of data series included.
Now let's create a scatter chart that shows maximum and average freight in each city and each 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.
|
Give your report a title like “Maximum and Average Freight in Years for City”. |
|
2.
|
Drag the HTML5 Charts element into the summary band, and select Scatter. |
|
3.
|
In the Outline view, right click on the chart element, and choose Edit chart properties. |
|
4.
|
In HTML5 Chart Properties > Chart Properties > Chart Data > Configuration create a Category with the following: |
|
•
|
Expression: $F{shipcountry} |
|
•
|
Value Class Name: java.lang.String |
Click OK.
|
5.
|
Create a second Category with the following: |
|
•
|
Expression: $F{shipcity} |
|
•
|
Value Class Name: java.lang.String |
Click OK.
|
6.
|
Create a Series with the following: |
|
•
|
Expression: YEAR($F{orderdate}) |
|
•
|
Value Class Name: java.lang.Integer |
Click OK.
|
7.
|
Add a Measure for maximum freight: |
|
•
|
Label Expression: “Max Freight” |
|
•
|
Value Expression: ${freight} |
|
•
|
Value Class Name: java.math.BigDecimal |
Click OK.
|
8.
|
Add a Measure for average freight: |
|
•
|
Label Expression: “Average Freight” |
|
•
|
Value Expression: ${freight} |
|
•
|
Value Class Name: java.math.BigDecimal |
Click OK.
Your Chart Properties dialog should look like the following:
To change the position or layout of the legend:
|
1.
|
Go to Chart Properties > Chart Properties. |
|
3.
|
Check the boxes for Show Legend and Floating Legend. |
|
4.
|
Using the drop-down menus, arrange the legend to appear in the top left. |
Click OK.
To add a border to the chart:
|
1.
|
Click the arrow next to Chart and highlight Borders and Plot Area. |
|
2.
|
Create a border for your chart by using the arrows next to Border Width or by typing the number of pixels. |
|
3.
|
Select a Border Color, Border Radius, and Border Width. |
|
5.
|
Save and preview your report. It should look like the following: |