Skip to content

Parcats

Overview

The parcats insight type is used to create parallel categories diagrams, which are useful for visualizing categorical data across multiple dimensions. It allows you to see how data flows through different categories and compare the distribution of values across them.

You can customize the colors, line widths, and category order to represent your data and patterns effectively.

Common Uses

  • Categorical Data Visualization: Visualizing relationships between different categorical variables.
  • Flow Analysis: Showing how data is distributed across multiple dimensions and comparing those paths.
  • Segmentation: Visualizing how different segments of data flow through categories.

Check out the Attributes for the full set of configuration options

Examples

Common Configurations

Here's a simple parcats insight showing how data flows across two categorical variables:

sources:
  - name: parcats-data-source
    type: duckdb
    database: target/seeds/parcats_data.duckdb
    seeds:
      - table_name: model
        args:
          - echo
          - |
            category_1,category_2,value
            A,X,30
            A,Y,20
            B,X,25
            B,Y,25

models:
  - name: parcats-data
    source: ${ref(parcats-data-source)}
    sql: select * from model
insights:
  - name: Simple Parcats Plot
    description: "Parallel Categories Diagram with two categorical variables"
    props:
      type: parcats
      dimensions:
        - label: "Category 1"
          values: ?{${ref(parcats-data).category_1}}
        - label: "Category 2"
          values: ?{${ref(parcats-data).category_2}}
      line:
        color: ?{${ref(parcats-data).value}}
        colorscale: "Viridis"
    interactions:
      - split: ?{category_1}
      - split: ?{category_2}
      - sort: ?{value DESC}

charts:
  - name: Simple Parcats Chart
    insights:
      - ${ref(Simple Parcats Plot)}
    layout:
      title:
        text: Simple Parcats Chart<br><sub>Parallel Categories Diagram</sub>

This example demonstrates a parcats insight with multiple categorical dimensions, showing how data flows across three categories:

sources:
  - name: parcats-data-multi-source
    type: duckdb
    database: target/seeds/parcats_data_multi.duckdb
    seeds:
      - table_name: model
        args:
          - echo
          - |
            category_1,category_2,category_3,value
            A,X,Alpha,30
            A,Y,Beta,20
            B,X,Alpha,25
            B,Y,Gamma,25

models:
  - name: parcats-data-multi
    source: ${ref(parcats-data-multi-source)}
    sql: select * from model
insights:
  - name: Parcats Plot with Multiple Dimensions
    description: "Flow across three categorical variables"
    props:
      type: parcats
      dimensions:
        - label: "Category 1"
          values: ?{${ref(parcats-data-multi).category_1}}
        - label: "Category 2"
          values: ?{${ref(parcats-data-multi).category_2}}
        - label: "Category 3"
          values: ?{${ref(parcats-data-multi).category_3}}
      line:
        color: ?{${ref(parcats-data-multi).value}}
        colorscale: "Blues"
    interactions:
      - split: ?{category_1}
      - split: ?{category_2}
      - split: ?{category_3}
      - sort: ?{value DESC}

charts:
  - name: Parcats Chart with Multiple Dimensions
    insights:
      - ${ref(Parcats Plot with Multiple Dimensions)}
    layout:
      title:
        text: Parcats Chart with Multiple Dimensions<br><sub>Flow Across Three Categories</sub>

This example shows a parcats insight with custom line widths based on a value, allowing the thickness of the lines to represent the volume of data:

sources:
  - name: parcats-data-linewidth-source
    type: duckdb
    database: target/seeds/parcats_data_linewidth.duckdb
    seeds:
      - table_name: model
        args:
          - echo
          - |
            category_1,category_2,value
            A,X,50
            A,Y,30
            B,X,40
            B,Y,20

models:
  - name: parcats-data-linewidth
    source: ${ref(parcats-data-linewidth-source)}
    sql: select * from model
insights:
  - name: Parcats Plot with Custom Line Widths
    description: "Custom line widths based on values"
    props:
      type: parcats
      dimensions:
        - label: "Category 1"
          values: ?{${ref(parcats-data-linewidth).category_1}}
        - label: "Category 2"
          values: ?{${ref(parcats-data-linewidth).category_2}}
      line:
        color: ?{${ref(parcats-data-linewidth).value}}
        width: ?{${ref(parcats-data-linewidth).value}}
        colorscale: "Jet"
    interactions:
      - split: ?{category_1}
      - split: ?{category_2}
      - sort: ?{value DESC}

charts:
  - name: Parcats Chart with Custom Line Widths
    insights:
      - ${ref(Parcats Plot with Custom Line Widths)}
    layout:
      title:
        text: Parcats Chart with Custom Line Widths<br><sub>Custom Line Width Based on Values</sub>