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:

  1. Select Reports in the Qlik NPrinting main menu, and then click Create report.
  2. Enter a Title for the report, for example: PixelPerfect Report Displaying Sparklines
  3. Select PixelPerfect from the Type drop-down list.
  4. Select an app from the App drop-down list. For example, select Sales Demo.
  5. Click Create to create the report.
  6. Click Edit template to open the Template Editor.

Open select levels window

First, create a Salesman level.

Do the following:

  1. Right-click the Levels node, and then select Add levels.
  2. Select the Connection to the QlikView document that contains the object you want. For example, select Sales Demo.
  3. Select Total Salesman Sales - CH327 from the objects list.

  4. Click OK.

Add sparklines data source as table

Next, add the data source for the sparklines.

Do the following:

  1. Right-click the Tables node, and then select Add objects.

Select object as table

Do the following:

  1. Select the Connection to the QlikView document that contains the object you want. For example, select Sales Demo.
  2. Select Sales by YearMonthNum - CH326.

  3. Click OK.

Create detail level in template

Do the following:

  1. Right-click on the Detail drop-down list in the Detail bar, and then select Insert Detail Report.
  2. Select CH327_Level.

Create table header bar and range

Do the following:

  1. Right-click the Detail Report - "CH327_Level" drop-down list, and then select Insert Band.
  2. Click GroupHeader.

Create table row

Do the following:

  1. Expand the CH327_Level node.
  2. Select the Salesman and Total Sales fields, and then drag and drop them into the Detail1 range.
  3. 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:

  1. Select the Borders attribute under Appearance in the Property Grid.
  2. Open the drop-down list and clicking on the drop-down button, and then select All.
  3. Click the drop-down button again to accept the change.

Open FormatString window

Do the following:

  1. Select the [CH327_Level.Total Sales] cell.
  2. Click the angle bracket > above the upper right corner of the cell.
  3. Click the browse button at the extreme right of Format String field.

Format total sales column

Do the following:

  1. Select Currency, under Category.
  2. Select the Custom tab.
  3. Enter $ #,##0.
  4. 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:

  1. Select the Sparkline object from the Tool Box, which is generally docked on the right but can be floated and positioned for convenience.
  2. Drag it into the Detail range and drop it to the right of the previously embedded cells.
  3. Drag the right border of the Sparkline cell to the right margin.
  4. Click the angle bracket > above the upper right corner of the Sparkline cell to open the Sparkline Tasks window.
  5. Open the Data Member drop-down list, and then select CH326.
  6. Open the Value Member drop-down list, and then select Sales1 under CH326.
  7. Leave View set to Line.
  8. 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:

  1. Make sure the Sparkline cell is still selected.
  2. Select the Borders attribute under Appearance in the Property Grid.
  3. Open the drop-down list by clicking on the down-pointing triangle at the far right of the Borders field.
  4. 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:

  1. Expand the View group list of attributes in the Appearance section.
  2. Set Highlight Max Point to Yes.
  3. Set Highlight Min Point to Yes.
  4. Set Max Point Color to Green (0, 192, 0), or the color of your choice.
  5. Set Min Point Color to Red (192, 0, 0), or the color of your choice.

Create table header

Do the following:

  1. Drag the Table object from the Tool Box and drop it into GroupHeader1 range.
  2. Set the font to Arial, 12px, Bold, Centered.
  3. Drag the cell right borders so that they line up with those in the Detail1 range.
  4. Add All cell borders using the Borders property (as described earlier in this section).
  5. Enter the following column headings: Salesman, Total Sales, Monthly Sales Chart.
  6. 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:

  1. Click Preview.
  2. Check the report, close it, and then edit the template again if necessary.
  3. Click Save and Close to save the template and close the Template Editor.