-
-
Notifications
You must be signed in to change notification settings - Fork 79
Open
Description
I'm trying to make summary tables with various groupings, but I can't get filtering to work. Using the athletes example, I added a new nationality
query + corresponding table, which initially loads great.
data:
nationality:
view: true
query: SELECT
nationality,
COUNT(*) FILTER (sex = 'male') AS males,
COUNT(*) FILTER (sex = 'female') AS females,
COUNT(*) AS athletes,
FROM athletes
GROUP BY nationality
When crossfiltering, it tries to apply the filter on the nationality
table post-grouping, when it needs to happen on the source athletes table, then rerun the nationality sql.
Candidate bindings: "nationality.athletes"
LINE 1: ... "athletes" FROM "nationality" WHERE (("weight" BETWEEN 51.82397003745318 AND ...
I tried setting it as a view, but that didn't change anything. Is there a way to properly cascade data dependencies?

Full modified yaml
meta:
title: Olympic Athletes
description: >
An interactive dashboard of athlete statistics. The menus and searchbox
filter the display and are automatically populated by backing data columns.
data:
athletes: { file: data/athletes.parquet }
nationality:
view: true
query: SELECT
nationality,
COUNT(*) FILTER (sex = 'male') AS males,
COUNT(*) FILTER (sex = 'female') AS females,
COUNT(*) AS athletes,
FROM athletes
GROUP BY nationality
params:
category: { select: intersect }
query: { select: intersect, include: $category }
hover: { select: intersect, empty: true } # select nothing when empty
hconcat:
- vconcat:
- hconcat:
- input: menu
label: Sport
as: $category
from: athletes
column: sport
- input: menu
label: Sex
as: $category
from: athletes
column: sex
- input: search
label: Name
filterBy: $category
as: $query
from: athletes
column: name
type: contains
- vspace: 10
- plot:
- mark: dot
data: { from: athletes, filterBy: $query }
x: weight
y: height
fill: sex
r: 2
opacity: 0.1
- mark: regressionY
data: { from: athletes, filterBy: $query }
x: weight
y: height
stroke: sex
- select: intervalXY
as: $query
brush: { fillOpacity: 0, stroke: black }
- mark: dot
data: { from: athletes, filterBy: $hover }
x: weight
y: height
fill: sex
stroke: currentColor
strokeWidth: 1
r: 3
xyDomain: Fixed
colorDomain: Fixed
margins: { left: 35, top: 20, right: 1 }
width: 570
height: 350
- vspace: 5
- input: table
from: athletes
maxWidth: 570
height: 250
filterBy: $query
as: $hover
columns: [name, nationality, sex, height, weight, sport]
width: { name: 180, nationality: 100, sex: 50, height: 50, weight: 50, sport: 100 }
- input: table
from: nationality
maxWidth: 570
height: 250
filterBy: $query
columns: [nationality, males, females, athletes]
width: { nationality: 100, males: 75, females: 75, athletes: 75 }
Metadata
Metadata
Assignees
Labels
No labels