Przeskocz do zawartości głównej Przejdź do treści uzupełniającej

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).

video thumbnail

Sparkline

Sample report showing sparklines created with PixelPerfect designer

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 Database icon with plus symbol 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.

  1. Open the Database icon with plus symbol Field List menu available from the right-side panel in the designer.

  2. Click the plus icon next to Tables.

  3. From the available sheets, select the Qlik Sense chart you want to add as a table. Click the Plus icon next to it.

    The data binding is added.

  4. From the toolbox panel on the left side of the designer, drag a Sparkline onto the design surface.

  5. 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.

  6. Open the Gear Properties menu from the right side of the designer, and expand Data.

  7. For Value Member, select the variable metric you want to visualize (for example, sales).

Refreshing source data for data bindings

Z biegiem czasu konfiguracja wykresu źródłowego może ulec zmianie, co wymaga podjęcia działań w szablonie raportu PixelPerfect. Dane źródłowe aplikacji można odświeżać w powiązaniach danych, które definiują wykres przebiegu w czasie. Przydaje się to, kiedy:

  • Wymiary i miary zostały dodane do wykresu źródłowego lub z niego usunięte od czasu utworzenia powiązania danych.

  • Definicje wymiarów i miar zostały zmienione w wykresie źródłowym od czasu utworzenia powiązania danych.

Odświeżanie źródeł powiązań danych umożliwia zachowanie tych samych obiektów w menu Ikona bazy danych z symbolem plusa Lista pól bez konieczności tworzenia nowych wraz ze zmianą konfiguracji wykresu.

  1. Otwórz menu Ikona bazy danych z symbolem plusa Lista pól w prawym panelu kreatora.

  2. Kliknij dwukrotnie pozycję Tabele, aby ją rozwinąć.

  3. Wskaż kursorem element, który chcesz odświeżyć.

  4. Kliknij ikonę odświeżania (Aktualizuj kolumny).

    Odświeżanie powiązania danych tabeli w menu Lista pól

    Kliknięcie ikony „Aktualizuj kolumny” w celu odświeżenia powiązania danych poziomu
  5. Kontynuuj opracowywanie szablonu zgodnie ze swoim zastosowaniem. Może to obejmować zmianę konfiguracji istniejącej zawartości lub dodanie nowej zawartości. Po odświeżeniu powiązania danych nowo dodane kolumny wykresu będą teraz dostępne do użycia z menu Ikona bazy danych z symbolem plusa Lista pól.

Example - Sparklines with a level

Przykładowe źródła aplikacji można znaleźć tutaj: Przykładowe materiały — raportowanie w aplikacji. Prześlij aplikację i pliki danych do przestrzeni, a następnie ponownie załaduj aplikację. Możesz teraz ukończyć ten przykład.

We will create sparklines with monthly sales by region.

Part 1: Add data bindings

  1. Create a new PixelPerfect template.

  2. Open the Database icon with plus symbol Field List menu available from the right-side panel in the designer.

    Field List menu in the PixelPerfect designer

    The 'Field List' menu expanded from the right side panel in the PixelPerfect designer
  3. Click the plus icon next to Levels.

  4. Expand Fields, and click the Plus icon next to Region.

    The data binding is added.

  5. You are brought back to the main Database icon with plus symbol Field List menu. Click the plus icon next to Tables.

  6. Expand the Sales Table sheet, and click the Plus 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.

  1. Right-click the Detail1 band, and then click Insert BandDetailReport.

  2. To bind the DetailReport1 band to the level, select the band and then open the Gear Properties menu. Under Detail Report TasksData Member, select the Region level.

Part 3: Add a label and sparkline

  1. Open the Database icon with plus symbol Field List menu, and double-click Levels to expand it.

  2. 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.

  3. From the toolbox panel on the left side of the designer, drag a Sparkline onto the DetailReport1 band, below the Region label.

  4. Resize the sparkline so that it occupies all horizontal space on the band, and its shape is a narrow rectangle.

  5. Resize the DetailReport1 band so there is a small space at the bottom of the sparkline.

    Region label and empty sparkline added to template

    Report template showing a title label for the 'Region' level added to a band, and below it the empty Sparkline object
  6. Select the sparkline and then open the Gear Properties menu.

  7. Expand AppearanceView.

  8. Check Highlight Max Point and Highlight Min Point.

  9. For Color, expand the drop down menu. Paste the following hex code in the # field: 0d00ff. Click OK.

  10. For Max Point Color, expand the drop down menu. Paste the following hex code in the # field: 0dff00. Click OK.

  11. For Min Point Color, expand the drop down menu. Paste the following hex code in the # field: ff0000. Click OK.

  12. In the top right corner, click Save template.

  13. Click Preview report. Download the report and open it.

Report preview with sparklines

Generated report with a series of sparklines - one for each region. The sparklines contain color-coded points showing the minimum and maximum vales for the calculated performance metric

Czy ta strona była pomocna?

Jeżeli natkniesz się na problemy z tą stroną lub jej zawartością — literówkę, brakujący krok lub błąd techniczny — daj nam znać!