Adding sparklines
A sparkline is a simple visualization, usually styled in the form of a line, that is helpful for analyzing trends for a single metric. You can add sparklines to your PixelPerfect report using the Sparkline object.
A sparkline generally consists of a field (equivalent to a dimension) and a value member (equivalent to a measure).
Sparkline

Requirements
The data you use for a sparkline has to be added as a table data binding. These data bindings are added under Tables in the Field List menu.
The source data for the sparkline should ideally contain a single dimension and a single measure. To use sparklines to visualize more complex, multi-dimensional data, it is recommended that you apply a level to the band where you add the sparkline. In this case, the level should be an additional dimension along which you want to cycle the generation of multiple filtered sparklines.
Creating sparklines
This is the recommended workflow for adding sparklines in your report.
次の手順を実行します。
-
Open the
Field List menu available from the right-side panel in the designer.
-
Click the plus icon next to Tables.
-
From the available sheets, select the Qlik Sense chart you want to add as a table. Click the
icon next to it.
The data binding is added.
-
From the toolbox panel on the left side of the designer, drag a Sparkline onto the design surface.
-
Click the gear icon that appears next to the sparkline. In the pop-up menu, for Data Member, select the table data binding you created earlier.
-
Open the
Properties menu from the right side of the designer, and expand Data.
-
For Value Member, select the variable metric you want to visualize (for example, sales).
Refreshing source data for data bindings
時間の経過とともにソース チャートの構成が変更されることがあり、それに応じて PixelPerfect レポート テンプレート側で対応が必要になる場合があります。スパークラインを定義するデータ バインディングでソース アプリ データを更新できます。これは次のような場合に便利です。
-
データ バインディングを作成した後に、ソース チャートの軸やメジャーが追加または削除された場合。
-
データ バインディングを作成した後に、ソース チャートの軸やメジャーの定義が変更された場合。
データ バインディングのソースを更新することで、チャートの構成が変更された場合でも、 [項目リスト] メニュー内の同じオブジェクトを引き続き使用でき、新たに作成し直す必要がなくなります。
次の手順を実行します。
-
デザイナーの右側のパネルにある
[項目 リスト] メニューを開きます。
-
[テーブル] をダブルクリックして展開します。
-
更新する項目にカーソルを合わせます。
-
更新 (列を更新) アイコンをクリックします。
[項目リスト] メニューのテーブル データ バインディングを更新する
![クリックしてフル サイズを表示 [列を更新] アイコンをクリックして、テーブルのデータ バインディングを更新する](../../Resources/Images/ui-gen-pixelperfect-refresh-table-binding.png)
-
ユース ケースに応じてテンプレートの開発を続行します。これには、既存のコンテンツの再構成や新しいコンテンツの追加が含まれる場合があります。データバインディングを更新すると、新しく追加されたチャート列が
[項目リスト] メニューから使用できるようになります。
Example - Sparklines with a level
アプリのソースの例は、次を参照してください。サンプル資料 - アプリ内レポート。アプリとデータ ファイルをスペースにアップロードし、アプリをリロードします。これで、例を完了する準備が整いました。
We will create sparklines with monthly sales by region.
Part 1: Add data bindings
次の手順を実行します。
-
Create a new PixelPerfect template.
-
Open the
Field List menu available from the right-side panel in the designer.
Field List menu in the PixelPerfect designer

-
Click the plus icon next to Levels.
-
Expand Fields, and click the
icon next to Region.
The data binding is added.
-
You are brought back to the main
Field List menu. Click the plus icon next to Tables.
-
Expand the Sales Table sheet, and click the
icon next to the Regional Sales over Time chart.
The data binding is added.
Part 2: Add DetailReport band and connect it with data banding
You need to create a DetailReport band to use a level.
次の手順を実行します。
-
Right-click the Detail1 band, and then click Insert Band > DetailReport.
-
To bind the DetailReport1 band to the level, select the band and then open the
Properties menu. Under Detail Report Tasks > Data Member, select the Region level.
Part 3: Add a label and sparkline
次の手順を実行します。
-
Open the
Field List menu, and double-click Levels to expand it.
-
For Region, expand the level object and drag the Region field within it onto the DetailReport1 band.
Position the label at the top of the band, centered horizontally.
-
From the toolbox panel on the left side of the designer, drag a Sparkline onto the DetailReport1 band, below the Region label.
-
Resize the sparkline so that it occupies all horizontal space on the band, and its shape is a narrow rectangle.
-
Resize the DetailReport1 band so there is a small space at the bottom of the sparkline.
Region label and empty sparkline added to template

-
Select the sparkline and then open the
Properties menu.
-
Expand Appearance > View.
-
Check Highlight Max Point and Highlight Min Point.
-
For Color, expand the drop down menu. Paste the following hex code in the # field: 0d00ff. Click OK.
-
For Max Point Color, expand the drop down menu. Paste the following hex code in the # field: 0dff00. Click OK.
-
For Min Point Color, expand the drop down menu. Paste the following hex code in the # field: ff0000. Click OK.
-
In the top right corner, click Save template.
-
Click Preview report. Download the report and open it.
Report preview with sparklines
