How to :: highlight specific data

Warning

For now this option will only work on the horizontal-barchart type and from the code mode.

Overview

You can highlight in a different color labels in your chart.

📝 For example, you’re doing a ranking of competitors on your market and you want to highlight your brand.

Warning

Pay attention to indentation. It should be at the same level as “query”

Common configuration

In the below example, we highlight Thailand in our leaderboard.

label value
France 3
China 10
Thailand 6
charts: [
  {
    chartType: "horizontal-barchart"
    label: "label"
    value: "value"
    sort: "desc"
    dataset: "my_dataset"
  }
]
datasets:
  my_dataset:
    query: [
      domain: "theme_country"
    ]
    highlighted: [
      {
        label: "Thailand"
      }
    ]
    id: "my_dataset"

Highlighted defined inside the dataset

The highlights can be handled directly in a column from the dataset, still Thailand :

label value highlight
France 3 0
China 10 0
Thailand 6 1

Then the configuration block will be :

charts: [
  {
    chartType: "horizontal-barchart"
    label: "label"
    value: "value"
    sort: "desc"
    dataset: "my_dataset"
  }
]
datasets:
  my_dataset:
    query: [
      domain: "theme_country"
    ]
    highlighted: "highlight"

The lines where ‘highlight=1’ will be highlighted.

Adapt highlights depending on multiple columns

Use this type of configuration if you want the highlights change depending on the filter

label value segmentation
France 3 femme
China 15 femme
France 20 homme
China 1 homme
charts: [
  {
    chartType: "horizontal-barchart"
    label: "label"
    value: "value"
    sort: "desc"
    dataset: "my_dataset"
    filters:
      "upper-middle":
        on: "segmentation"
  }
]
datasets:
  my_dataset:
    query: [
      domain: "theme_country"
    ]
    highlighted: [
      label: 'China'
      segmentation: 'femme'
    ,
      label: 'France'
      segmentation: 'homme'
    ]