Thursday, February 27, 2014

Creating Multi-Layer Charts

Often a more complex chart is needed to effectively summarize information. Logi Reports supports combination charts that allow multiple layers and multiple chart types to be included on a single chart.

In this example, we’ll add another layer to the line chart developed in the previous section.

Step 1: Add a second grid layer

To add another layer to the chart, add Extra Grid Layer and Secondary Data Access child elements beneath the Chart.XY element:

Figure 5.8: Definition Editor Panel after adding elements 

Set the Secondary Data Axis element’s Data Title attribute to a meaningful description (i.e. “Freight”).
 

Step 2: Define the data to display in the new grid layer

Modify the data layer’s SQL query to return the total freight costs in addition to the number of orders, as shown below:

SELECT TOP 10 CustomerID, 
   COUNT(CustomerID)  AS OrderCount,
   SUM(Freight) AS Freight
FROM Orders
GROUP BY CustomerID
ORDER BY COUNT(CustomerID) DESC

Set the Extra Grid Layer element’s Data Column Y-axis attribute to the new total freight costs field in the data layer (i.e. Freight). Then set the presentation attributes (Chart Type and Color) to display the data as a brown line chart.
 
Figure 5.9: Attributes Panel after setting attributes

Assuming that the Chart.XY element’s Chart Type is also set to "Line", then when you preview the report, the resulting multi-line chart is presented as shown below.

Figure 5.10: Report Preview Panel showing line chart

Notice that the second y-axis scale (“Freight”) is shown on the right side of the grid chart. 

Of course, it’s not necessary that both grid layers display the same chart type. Simply change one of the Chart Type attributes on the Chart.Grid or Extra Grid Layer element to combine multiple chart types on a single chart.  



No comments:

Post a Comment