Forum Discussion

samuelstinger's avatar
2 years ago
Solved

Deneb Visual Legend Filtration during filtering

Hello all!

 

I have a some report with using Deneb Visual as replace a standard PowerBI Multiline Chart.

It`s works fine.

Normal state

But there is a problem with the chart legend when I select the data in another visual.

 

Something wrong

 

Legend items are not filtered as expect. Selected item moved up, but another items still visible.

 

Does anyone know how to hide the filtered items in the legend.

Specification of  the Chart

 

 

{
  "data": {"name": "dataset"},
  "transform": [
    {
      "calculate": "datum['Brand']",
      "as": "dim"
    },
    {
      "calculate": "isDefined(datum['Brand'])?datum['Brand']:datum.dim",
      "as": "dim"
    },
    {
      "calculate": "isDefined(datum['Market Org'])?datum['Market Org']:datum.dim",
      "as": "dim"
    },
    {
      "calculate": "isDefined(datum['Rx/OTC'])?datum['Rx/OTC']:datum.dim",
      "as": "dim"
    },
    {
      "calculate": "isDefined(datum['Category'])?datum['Category']:datum.dim",
      "as": "dim"
    },
    {
      "calculate": "isDefined(datum['SKU'])?datum['SKU']:datum.dim",
      "as": "dim"
    }
  ],
  "encoding": {
    "x": {
      "field": "date",
      "type": "temporal",
      "axis": {
        "format": "MMM yyyy",
        "formatType": "pbiFormat"
      }
    },
    "y": {
      "field": "ac",
      "type": "quantitative",
      "axis": {
        "labelExpr": "format(datum.value,data('dataset')[0]['ExprType']=='SO'?',.3~s':(data('dataset')[0]['ExprType']=='MS'?'0.0%':'0'))"
      }
    },
    "color": {
      "field": "dim",
      "type": "nominal",
      "sort": {
        "field": "ac",
        "order": "descending"
      }
    }
  },
  "layer": [
    {"mark": {"type": "line"}},
    {
      "mark": {"type": "line"},
      "params": [
        {
          "name": "hover",
          "select": {
            "type": "point",
            "on": "pointerover",
            "clear": "pointerout"
          }
        }
      ],
      "encoding": {
        "size": {
          "condition": {
            "test": {
              "param": "hover",
              "empty": false
            },
            "value": 4
          },
          "value": 1
        },
        "tooltip": [
          {
            "field": "date",
            "type": "temporal",
            "format": "MMM yyyy",
            "formatType": "pbiFormat"
          },
          {
            "field": "dim",
            "type": "nominal"
          },
          {
            "field": "ac",
            "type": "quantitative",
            "format": ",.3~s"
          }
        ]
      }
    }
  ]
}

 

 

Config

 

 

{
  "autosize": {
    "type": "fit",
    "contains": "padding"
  },
  "axisX": {
    "grid": true,
    "ticks": false,
    "domain": false,
    "title": false
  },
  "axisY": {
    "grid": true,
    "labels": true,
    "ticks": true,
    "domain": false,
    "title": false,
    "offset": 0
  },
  "legend": {"title": false}
}

 

 

Thanks!

  • I will answer myself.

     

    Deneb doesn't fully match selection behavior like PowerBI does.

    For fix this need go to Options and settings > Options > Report Settings and check this

    "Change default visual interaction from cross highlighting to cross filtering".

     

    At least it helped in my case!

     

    Thanks for your attention!

1 Reply

  • I will answer myself.

     

    Deneb doesn't fully match selection behavior like PowerBI does.

    For fix this need go to Options and settings > Options > Report Settings and check this

    "Change default visual interaction from cross highlighting to cross filtering".

     

    At least it helped in my case!

     

    Thanks for your attention!