{"track":"charts","examples":[{"id":"chart-trend","track":"charts","title":"Change over time","summary":"Time is on x and sorted, a line connects the months, and the baseline is not forced to zero.","principle":"chart-trend","tags":["charts","trend","line"],"evidence":["lib/json-render/recommend.ts (recommend, mapToSpec)","lib/json-render/catalog.ts (CHART_GUIDE)"],"body":{"kind":"chart","question":"change over time","intent":"trend","expect":{"mark":"line"},"spec":{"title":"Signups","description":"Signups over Month","provenance":"data","state":{"data":{"signups":[{"month":"2026-01-01","signups":116},{"month":"2026-02-01","signups":145},{"month":"2026-03-01","signups":142},{"month":"2026-04-01","signups":156},{"month":"2026-05-01","signups":179},{"month":"2026-06-01","signups":207},{"month":"2026-07-01","signups":206},{"month":"2026-08-01","signups":211},{"month":"2026-09-01","signups":246},{"month":"2026-10-01","signups":250},{"month":"2026-11-01","signups":245},{"month":"2026-12-01","signups":260}]}},"root":{"type":"Page","children":[{"type":"Grid","props":{"columns":1},"children":[{"type":"Stat","props":{"label":"Signups","value":2363,"delta":"+6.1%","trend":"up","caption":"total; latest 260 vs 245 before"}}]},{"type":"Card","children":[{"type":"Chart","props":{"mark":"line","encoding":{"x":{"field":"month","type":"temporal"},"y":{"field":"signups","type":"quantitative","aggregate":"sum","title":"Signups"}},"sort":"x","title":"Signups over Month","description":"month is time, so position along x shows change","data":{"$state":"/data/signups"}}}]},{"type":"Card","props":{"title":"Rows"},"children":[{"type":"Table","props":{"columns":[{"key":"month","label":"Month","format":"date"},{"key":"signups","label":"Signups","align":"right"}],"rows":{"$state":"/data/signups"},"pageSize":10,"caption":"12 rows from signups"}}]},{"type":"Callout","props":{"variant":"neutral","title":"About this data","body":"12 rows, 2 columns from \"signups\". No missing values."}}]}}}},{"id":"chart-compare","track":"charts","title":"Compare categories","summary":"Bars from a zero baseline, sorted by value, so the order is the finding.","principle":"chart-compare","tags":["charts","compare","bar"],"evidence":["lib/json-render/recommend.ts (recommend, mapToSpec)","lib/json-render/catalog.ts (CHART_GUIDE)"],"body":{"kind":"chart","question":"compare categories","intent":"compare","expect":{"mark":"bar","sort":"-y"},"spec":{"title":"Scores","description":"Score by Assignment","provenance":"data","state":{"data":{"scores":[{"assignment":"Lab 1","score":72},{"assignment":"Lab 2","score":79},{"assignment":"Quiz 1","score":82},{"assignment":"Lab 3","score":94},{"assignment":"Project","score":77},{"assignment":"Final","score":81}]}},"root":{"type":"Page","children":[{"type":"Grid","props":{"columns":1},"children":[{"type":"Stat","props":{"label":"Score","value":80.8333333333,"caption":"average of 6 rows"}}]},{"type":"Card","children":[{"type":"Chart","props":{"mark":"bar","encoding":{"x":{"field":"assignment","type":"nominal"},"y":{"field":"score","type":"quantitative","aggregate":"mean","title":"Score"}},"sort":"-y","horizontal":false,"title":"Score by Assignment","description":"bars from a zero baseline compare magnitudes accurately","data":{"$state":"/data/scores"}}}]},{"type":"Card","props":{"title":"Rows"},"children":[{"type":"Table","props":{"columns":[{"key":"assignment","label":"Assignment"},{"key":"score","label":"Score","align":"right"}],"rows":{"$state":"/data/scores"},"pageSize":10,"caption":"6 rows from scores"}}]},{"type":"Callout","props":{"variant":"neutral","title":"About this data","body":"6 rows, 2 columns from \"scores\". No missing values."}}]}}}},{"id":"chart-rank","track":"charts","title":"Ranking","summary":"Fourteen courses, so it shows the top ten as horizontal bars and says the rest were folded away.","principle":"chart-rank","tags":["charts","rank","bar"],"evidence":["lib/json-render/recommend.ts (recommend, mapToSpec)","lib/json-render/catalog.ts (CHART_GUIDE)"],"body":{"kind":"chart","question":"ranking / top N","intent":"rank","expect":{"mark":"bar","horizontal":true,"sort":"-y"},"spec":{"title":"Enrollment","description":"Enrollment by Course (ranked)","provenance":"data","state":{"data":{"enrollment":[{"course":"Intro to ML","enrollment":216},{"course":"Data Structures","enrollment":199},{"course":"Databases","enrollment":186},{"course":"Ethics in AI","enrollment":188},{"course":"Networks","enrollment":170},{"course":"Algorithms","enrollment":154},{"course":"Statistics","enrollment":144},{"course":"Linear Algebra","enrollment":131},{"course":"Compilers","enrollment":121},{"course":"Security","enrollment":120},{"course":"Graphics","enrollment":98},{"course":"HCI","enrollment":97},{"course":"Cloud","enrollment":81},{"course":"Robotics","enrollment":62}]}},"root":{"type":"Page","children":[{"type":"Grid","props":{"columns":1},"children":[{"type":"Stat","props":{"label":"Enrollment","value":1967,"caption":"total of 14 rows"}}]},{"type":"Card","children":[{"type":"Chart","props":{"mark":"bar","encoding":{"x":{"field":"course","type":"nominal"},"y":{"field":"enrollment","type":"quantitative","aggregate":"sum","title":"Enrollment"}},"sort":"-y","horizontal":true,"topK":10,"title":"Enrollment by Course (ranked)","description":"bars from a zero baseline compare magnitudes accurately","data":{"$state":"/data/enrollment"}}}]},{"type":"Card","props":{"title":"Rows"},"children":[{"type":"Table","props":{"columns":[{"key":"course","label":"Course"},{"key":"enrollment","label":"Enrollment","align":"right"}],"rows":{"$state":"/data/enrollment"},"pageSize":10,"caption":"14 rows from enrollment"}}]},{"type":"Callout","props":{"variant":"neutral","title":"About this data","body":"14 rows, 2 columns from \"enrollment\". No missing values."}}]}}}},{"id":"chart-composition","track":"charts","title":"Part of a whole","summary":"Four parts of one total: few enough that angles still compare. Past five it switches to bars.","principle":"chart-composition","tags":["charts","composition","arc"],"evidence":["lib/json-render/recommend.ts (recommend, mapToSpec)","lib/json-render/catalog.ts (CHART_GUIDE)"],"body":{"kind":"chart","question":"part of a whole","intent":"composition","expect":{"mark":"arc"},"spec":{"title":"Sessions","description":"Share of Sessions by Device","provenance":"data","state":{"data":{"sessions":[{"device":"Phone","sessions":5400},{"device":"Laptop","sessions":3900},{"device":"Tablet","sessions":700},{"device":"Other","sessions":250}]}},"root":{"type":"Page","children":[{"type":"Grid","props":{"columns":1},"children":[{"type":"Stat","props":{"label":"Sessions","value":10250,"caption":"total of 4 rows"}}]},{"type":"Card","children":[{"type":"Chart","props":{"mark":"arc","encoding":{"color":{"field":"device","type":"nominal"},"theta":{"field":"sessions","type":"quantitative","aggregate":"sum"}},"title":"Share of Sessions by Device","description":"4 parts (≤ 5) of one total: angles are still comparable","data":{"$state":"/data/sessions"}}}]},{"type":"Card","props":{"title":"Rows"},"children":[{"type":"Table","props":{"columns":[{"key":"device","label":"Device"},{"key":"sessions","label":"Sessions","align":"right"}],"rows":{"$state":"/data/sessions"},"pageSize":10,"caption":"4 rows from sessions"}}]},{"type":"Callout","props":{"variant":"neutral","title":"About this data","body":"4 rows, 2 columns from \"sessions\". No missing values."}}]}}}},{"id":"chart-composition-many","track":"charts","title":"Too many parts for a pie","summary":"Nine regions: the recommender refuses a pie and draws sorted bars, because nine slices cannot be compared.","principle":"chart-composition","tags":["charts","composition","bar"],"evidence":["lib/json-render/recommend.ts (recommend, mapToSpec)","lib/json-render/catalog.ts (CHART_GUIDE)"],"body":{"kind":"chart","question":"part of a whole","intent":"composition","expect":{"mark":"bar","horizontal":true,"sort":"-y"},"spec":{"title":"Revenue","description":"Revenue by Region (parts)","provenance":"data","state":{"data":{"revenue":[{"region":"North","revenue":927},{"region":"South","revenue":805},{"region":"East","revenue":783},{"region":"West","revenue":671},{"region":"Central","revenue":584},{"region":"Coastal","revenue":471},{"region":"Highland","revenue":408},{"region":"Island","revenue":349},{"region":"Border","revenue":258}]}},"root":{"type":"Page","children":[{"type":"Grid","props":{"columns":1},"children":[{"type":"Stat","props":{"label":"Revenue","value":5256,"caption":"total of 9 rows"}}]},{"type":"Card","children":[{"type":"Chart","props":{"mark":"bar","horizontal":true,"sort":"-y","encoding":{"x":{"field":"region","type":"nominal"},"y":{"field":"revenue","type":"quantitative","aggregate":"sum"}},"topK":10,"title":"Revenue by Region (parts)","description":"9 parts is too many for a pie; sorted bars show each part's size","data":{"$state":"/data/revenue"}}}]},{"type":"Card","props":{"title":"Rows"},"children":[{"type":"Table","props":{"columns":[{"key":"region","label":"Region"},{"key":"revenue","label":"Revenue","align":"right"}],"rows":{"$state":"/data/revenue"},"pageSize":10,"caption":"9 rows from revenue"}}]},{"type":"Callout","props":{"variant":"neutral","title":"About this data","body":"9 rows, 2 columns from \"revenue\". No missing values."}}]}}}},{"id":"chart-distribution","track":"charts","title":"Distribution","summary":"Eighty scores binned by the Freedman-Diaconis rule, so spread, skew and outliers show.","principle":"chart-distribution","tags":["charts","distribution","histogram"],"evidence":["lib/json-render/recommend.ts (recommend, mapToSpec)","lib/json-render/catalog.ts (CHART_GUIDE)"],"body":{"kind":"chart","question":"distribution","intent":"distribution","expect":{"mark":"histogram"},"spec":{"title":"Quiz","description":"Distribution of Score","provenance":"data","state":{"data":{"quiz":[{"student":"S1","score":65},{"student":"S2","score":60},{"student":"S3","score":77},{"student":"S4","score":100},{"student":"S5","score":66},{"student":"S6","score":91},{"student":"S7","score":63},{"student":"S8","score":67},{"student":"S9","score":76},{"student":"S10","score":75},{"student":"S11","score":82},{"student":"S12","score":66},{"student":"S13","score":66},{"student":"S14","score":69},{"student":"S15","score":61},{"student":"S16","score":55},{"student":"S17","score":71},{"student":"S18","score":72},{"student":"S19","score":53},{"student":"S20","score":60},{"student":"S21","score":64},{"student":"S22","score":79},{"student":"S23","score":66},{"student":"S24","score":86},{"student":"S25","score":70},{"student":"S26","score":89},{"student":"S27","score":80},{"student":"S28","score":72},{"student":"S29","score":66},{"student":"S30","score":80},{"student":"S31","score":89},{"student":"S32","score":55},{"student":"S33","score":60},{"student":"S34","score":87},{"student":"S35","score":61},{"student":"S36","score":74},{"student":"S37","score":69},{"student":"S38","score":66},{"student":"S39","score":66},{"student":"S40","score":69},{"student":"S41","score":74},{"student":"S42","score":56},{"student":"S43","score":64},{"student":"S44","score":99},{"student":"S45","score":49},{"student":"S46","score":75},{"student":"S47","score":66},{"student":"S48","score":77},{"student":"S49","score":69},{"student":"S50","score":72},{"student":"S51","score":66},{"student":"S52","score":53},{"student":"S53","score":72},{"student":"S54","score":70},{"student":"S55","score":100},{"student":"S56","score":75},{"student":"S57","score":64},{"student":"S58","score":73},{"student":"S59","score":81},{"student":"S60","score":40},{"student":"S61","score":69},{"student":"S62","score":69},{"student":"S63","score":67},{"student":"S64","score":58},{"student":"S65","score":88},{"student":"S66","score":75},{"student":"S67","score":60},{"student":"S68","score":49},{"student":"S69","score":54},{"student":"S70","score":72},{"student":"S71","score":69},{"student":"S72","score":78},{"student":"S73","score":78},{"student":"S74","score":58},{"student":"S75","score":60},{"student":"S76","score":71},{"student":"S77","score":91},{"student":"S78","score":78},{"student":"S79","score":85},{"student":"S80","score":64}]}},"root":{"type":"Page","children":[{"type":"Grid","props":{"columns":1},"children":[{"type":"Stat","props":{"label":"Score","value":70.3875,"caption":"average of 80 rows"}}]},{"type":"Card","children":[{"type":"Chart","props":{"mark":"histogram","encoding":{"x":{"field":"score","type":"quantitative"}},"title":"Distribution of Score","description":"a histogram shows spread, skew and outliers; bins by Freedman-Diaconis","data":{"$state":"/data/quiz"}}}]},{"type":"Card","props":{"title":"Rows"},"children":[{"type":"Table","props":{"columns":[{"key":"student","label":"Student"},{"key":"score","label":"Score","align":"right"}],"rows":{"$state":"/data/quiz"},"pageSize":10,"caption":"80 rows from quiz"}}]},{"type":"Callout","props":{"variant":"neutral","title":"About this data","body":"80 rows, 2 columns from \"quiz\". No missing values."}}]}}}},{"id":"chart-relationship","track":"charts","title":"Relationship of two numbers","summary":"Both axes are measures and the points are not connected, because rows are not a sequence.","principle":"chart-relationship","tags":["charts","relationship","point"],"evidence":["lib/json-render/recommend.ts (recommend, mapToSpec)","lib/json-render/catalog.ts (CHART_GUIDE)"],"body":{"kind":"chart","question":"relationship of two numbers","intent":"relationship","expect":{"mark":"point"},"spec":{"title":"Study","description":"Score vs Hours","provenance":"data","state":{"data":{"study":[{"student":"S1","hours":5.7,"score":72},{"student":"S2","hours":1.5,"score":45},{"student":"S3","hours":8.7,"score":88},{"student":"S4","hours":6.3,"score":79},{"student":"S5","hours":2.3,"score":55},{"student":"S6","hours":10.1,"score":82},{"student":"S7","hours":10.7,"score":83},{"student":"S8","hours":9.6,"score":80},{"student":"S9","hours":1.6,"score":61},{"student":"S10","hours":3,"score":52},{"student":"S11","hours":11,"score":89},{"student":"S12","hours":7.4,"score":85},{"student":"S13","hours":6.5,"score":76},{"student":"S14","hours":8.6,"score":92},{"student":"S15","hours":5.6,"score":67},{"student":"S16","hours":1.6,"score":62},{"student":"S17","hours":2.4,"score":49},{"student":"S18","hours":1.8,"score":59},{"student":"S19","hours":5.6,"score":71},{"student":"S20","hours":6.6,"score":78},{"student":"S21","hours":11.7,"score":100},{"student":"S22","hours":1.6,"score":65},{"student":"S23","hours":4.2,"score":60},{"student":"S24","hours":3.7,"score":61},{"student":"S25","hours":2.5,"score":73},{"student":"S26","hours":3.3,"score":50},{"student":"S27","hours":3.4,"score":55},{"student":"S28","hours":1.1,"score":62},{"student":"S29","hours":10,"score":84},{"student":"S30","hours":6.7,"score":65},{"student":"S31","hours":6.2,"score":71},{"student":"S32","hours":7.7,"score":74},{"student":"S33","hours":4.3,"score":60},{"student":"S34","hours":3.8,"score":61},{"student":"S35","hours":7.6,"score":76},{"student":"S36","hours":4,"score":60},{"student":"S37","hours":8.8,"score":73},{"student":"S38","hours":5.9,"score":74},{"student":"S39","hours":7.9,"score":81},{"student":"S40","hours":7.5,"score":68}]}},"root":{"type":"Page","children":[{"type":"Grid","props":{"columns":2},"children":[{"type":"Stat","props":{"label":"Hours","value":228.5,"caption":"total of 40 rows"}},{"type":"Stat","props":{"label":"Score","value":69.95,"caption":"average of 40 rows"}}]},{"type":"Card","children":[{"type":"Chart","props":{"mark":"point","encoding":{"x":{"field":"hours","type":"quantitative"},"y":{"field":"score","type":"quantitative"}},"title":"Score vs Hours","description":"two measures: a scatter shows correlation, clusters and outliers","data":{"$state":"/data/study"}}}]},{"type":"Card","props":{"title":"Rows"},"children":[{"type":"Table","props":{"columns":[{"key":"student","label":"Student"},{"key":"hours","label":"Hours","align":"right"},{"key":"score","label":"Score","align":"right"}],"rows":{"$state":"/data/study"},"pageSize":10,"caption":"40 rows from study"}}]},{"type":"Callout","props":{"variant":"neutral","title":"About this data","body":"40 rows, 3 columns from \"study\". No missing values."}}]}}}},{"id":"chart-kpi","track":"charts","title":"Headline numbers","summary":"When the question is how much, not how it moves, show the number with its change against the previous period.","principle":"chart-kpi","tags":["charts","kpi","Stat"],"evidence":["lib/json-render/recommend.ts (recommend, mapToSpec)","lib/json-render/catalog.ts (CHART_GUIDE)"],"body":{"kind":"chart","question":"kpi","intent":"kpi","expect":{"component":"Stat"},"spec":{"title":"Signups","provenance":"data","state":{"data":{"signups":[{"month":"2026-01-01","signups":116},{"month":"2026-02-01","signups":145},{"month":"2026-03-01","signups":142},{"month":"2026-04-01","signups":156},{"month":"2026-05-01","signups":179},{"month":"2026-06-01","signups":207},{"month":"2026-07-01","signups":206},{"month":"2026-08-01","signups":211},{"month":"2026-09-01","signups":246},{"month":"2026-10-01","signups":250},{"month":"2026-11-01","signups":245},{"month":"2026-12-01","signups":260}]}},"root":{"type":"Page","children":[{"type":"Grid","props":{"columns":1},"children":[{"type":"Stat","props":{"label":"Signups","value":2363,"delta":"+6.1%","trend":"up","caption":"total; latest 260 vs 245 before"}}]},{"type":"Card","props":{"title":"Rows"},"children":[{"type":"Table","props":{"columns":[{"key":"month","label":"Month","format":"date"},{"key":"signups","label":"Signups","align":"right"}],"rows":{"$state":"/data/signups"},"pageSize":10,"caption":"12 rows from signups"}}]},{"type":"Callout","props":{"variant":"neutral","title":"About this data","body":"12 rows, 2 columns from \"signups\". No missing values."}}]}}}},{"id":"chart-detail","track":"charts","title":"Exact values","summary":"When people need to look values up, a table with right-aligned numbers beats any chart.","principle":"chart-detail","tags":["charts","detail","Table"],"evidence":["lib/json-render/recommend.ts (recommend, mapToSpec)","lib/json-render/catalog.ts (CHART_GUIDE)"],"body":{"kind":"chart","question":"exact values / lookup","intent":"detail","expect":{"component":"Table"},"spec":{"title":"Gradebook","provenance":"data","state":{"data":{"gradebook":[{"assignment":"Lab 1","score":72,"graded":"yes","late":false},{"assignment":"Lab 2","score":79,"graded":"no","late":false},{"assignment":"Quiz 1","score":82,"graded":"yes","late":false},{"assignment":"Lab 3","score":94,"graded":"no","late":false},{"assignment":"Project","score":77,"graded":"yes","late":true},{"assignment":"Final","score":81,"graded":"no","late":false}]}},"root":{"type":"Page","children":[{"type":"Grid","props":{"columns":1},"children":[{"type":"Stat","props":{"label":"Score","value":80.8333333333,"caption":"average of 6 rows"}}]},{"type":"Card","props":{"title":"Rows"},"children":[{"type":"Table","props":{"columns":[{"key":"assignment","label":"Assignment"},{"key":"score","label":"Score","align":"right"},{"key":"graded","label":"Graded"},{"key":"late","label":"Late"}],"rows":{"$state":"/data/gradebook"},"pageSize":10,"caption":"6 rows from gradebook"}}]},{"type":"Callout","props":{"variant":"neutral","title":"About this data","body":"6 rows, 4 columns from \"gradebook\". No missing values."}}]}}}}]}