Using sparklines in PixelPerfect reports
You can create a PixelPerfect report with sparklines. A sparkline is a very small line chart, usually drawn with neither axes nor coordinates. It presents the movement of some measurement, typically with respect to time.
Following this example, you will create a table displaying a row for each salesman, presenting the salesman's total sales and a sparkline for monthly sales. A level for Salesman and his total sales will be added to create a table in the report. The sparkline object will be embedded in the level details range, and will take data from a QlikView table for sales by YearMonth.
Create a new PixelPerfect report in the report editor
Do the following:
- Select Reports in the Qlik NPrinting main menu, and then click Create report.
- Enter a Title for the report. PixelPerfect Report Displaying Sparklines
- Select PixelPerfect from the Type drop-down list.
- Select an app from the App drop-down list.
- Click Create to create the report.
- Click Edit template to open the Template Editor.
Open select levels window
First, create a Salesman level.
Do the following:
- Right-click the Levels node, and select Add levels.
- Select the Connection to the QlikView document that contains the object you want.
-
Select Total Salesman Sales - CH327 from the objects list.
- Click OK.
Add sparklines data source as table
Next, add the data source for the sparklines.
Do the following:
- Right-click the Tables node, and select Add objects.
Select object as table
Do the following:
- Select the Connection to the QlikView document that contains the object you want.
-
Select Sales by YearMonthNum - CH326.
- Click OK.
Create detail level in template
Do the following:
- Right-click on the Detail drop-down list in the Detail bar, and then select Insert Detail Report.
- Select CH327_Level.
Create table header bar and range
Do the following:
- Right-click the Detail Report - "CH327_Level" drop-down list, and then select Insert Band.
- Click GroupHeader.
Create table row
Do the following:
- Expand the CH327_Level node.
- Select the Salesman and Total Sales fields, and then drag and drop them into the Detail1 range.
- Drag the right border of the selected block of cells to the left to leave space for a sparkline cell.
Render cell borders visible
Do the following:
- Select the Borders attribute under Appearance in the Property Grid.
- Open the drop-down list and clicking on the drop-down button, and then select All.
- Click the drop-down button again to accept the change.
Open FormatString window
Do the following:
- Select the [CH327_Level.Total Sales] cell.
- Click the angle bracket > above the upper right corner of the cell.
- Click the browse button at the extreme right of Format String field.
Format total sales column
Do the following:
- Select Currency, under Category.
- Select the Custom tab.
- Enter $ #,##0.
- Click OK.
Embed sparkline element
You can create a sparkline in your template by using the sparkline tool. In the Property Grid, you can customize the appearance of the sparkline.
Do the following:
- Select the Sparkline object from the Tool Box, which is generally docked on the right but can be floated and positioned for convenience.
- Drag it into the Detail range and drop it to the right of the previously embedded cells.
- Drag the right border of the Sparkline cell to the right margin.
- Click the angle bracket > above the upper right corner of the Sparkline cell to open the Sparkline Tasks window.
- Open the Data Member drop-down list, and then select CH326.
- Open the Value Member drop-down list, and then select Sales1 under CH326.
- Leave View set to Line.
- To close the Sparkline Tasks pop-up window, click again on the angle bracket < above the upper right corner of the Sparkline cell.
Render bottom and right borders visible
Do the following:
- Make sure the Sparkline cell is still selected.
- Select the Borders attribute under Appearance in the Property Grid.
- Open the drop-down list by clicking on the down-pointing triangle at the far right of the Borders field.
- Select the Bottom and Right borders and click the drop-down button (as shown in the previous step) to accept the changes.
Configure view
Do the following:
- Expand the View group list of attributes in the Appearance section.
- Set Highlight Max Point to Yes.
- Set Highlight Min Point to Yes.
- Set Max Point Color to Green (0, 192, 0), or the color of your choice.
- Set Min Point Color to Red (192, 0, 0), or the color of your choice.
Create table header
Do the following:
- Drag the Table object from the Tool Box and drop it into GroupHeader1 range.
- Set the font to Arial, 12px, Bold, Centered.
- Drag the cell right borders so that they line up with those in the Detail1 range.
- Add All cell borders using the Borders property (as described earlier in this section).
- Enter the following column headings: Salesman, Total Sales, Monthly Sales Chart.
- Drag the lower borders of the GroupHeader1 and Detail1 ranges up to coincide with the lower border of the Heading and Data cells, respectively, to eliminate white space in the final report.
Preview and save
Do the following:
- Click Preview.
- Check the report, close it, and then edit the template again if necessary.
- Click Save and Close to save the template and close the Template Editor.