Skip to content

Commit

Permalink
add faceting to percent (microsoft#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
danmarshall authored Jan 12, 2020
1 parent ebf8c9b commit e4564a9
Show file tree
Hide file tree
Showing 32 changed files with 6,286 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"url": "https://sanddance.js.org/sample-data/titanicmaster.tsv",
"format": {
"type": "tsv"
}
},
"transform": [
{
"window": [{
"op": "row_number",
"as": "id"
}]
}
],
"height": 300,
"width": 300,
"mark": "bar",
"encoding": {
"facet": {
"field": "Joined",
"type": "nominal"
},
"y": {
"field": "Class",
"type": "nominal"
},
"x": {
"type": "quantitative",
"field": "id",
"aggregate": "count",
"stack": "normalize",
"axis": {
"format": "%"
}
},
"color": {"field": "id", "type": "nominal"},
"tooltip": {"field": "Name", "type": "nominal"}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"url": "https://sanddance.js.org/sample-data/titanicmaster.tsv",
"format": {
"type": "tsv"
}
},
"transform": [
{
"window": [{
"op": "row_number",
"as": "id"
}]
}
],
"height": 300,
"width": 300,
"mark": "bar",
"encoding": {
"facet": {
"field": "TicketCost",
"type": "quantitative",
"bin": {
"maxbins": 30
},
"columns": 10
},
"y": {
"field": "Class",
"type": "nominal"
},
"x": {
"type": "quantitative",
"field": "id",
"aggregate": "count",
"stack": "normalize",
"axis": {
"format": "%"
}
},
"color": {"field": "id", "type": "nominal"},
"tooltip": {"field": "Name", "type": "nominal"}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"url": "https://sanddance.js.org/sample-data/titanicmaster.tsv",
"format": {
"type": "tsv"
}
},
"transform": [
{
"window": [{
"op": "row_number",
"as": "id"
}]
}
],
"height": 300,
"width": 300,
"mark": "bar",
"encoding": {
"facet": {
"field": "Joined",
"type": "nominal"
},
"y": {
"field": "Class",
"type": "nominal"
},
"x": {
"type": "quantitative",
"field": "TicketCost",
"stack": "normalize",
"axis": {
"format": "%"
}
},
"order": {"aggregate": "sum", "field": "TicketCost", "type": "quantitative", "sort": "descending" },
"color": {"field": "id", "type": "nominal"},
"tooltip": {"field": "Name", "type": "nominal"}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"url": "https://sanddance.js.org/sample-data/titanicmaster.tsv",
"format": {
"type": "tsv"
}
},
"transform": [
{
"window": [{
"op": "row_number",
"as": "id"
}]
}
],
"height": 300,
"width": 300,
"mark": "bar",
"encoding": {
"facet": {
"field": "TicketCost",
"type": "quantitative",
"bin": {
"maxbins": 30
},
"columns": 10
},
"y": {
"field": "Class",
"type": "nominal"
},
"x": {
"type": "quantitative",
"field": "TicketCost",
"stack": "normalize",
"axis": {
"format": "%"
}
},
"order": {"aggregate": "sum", "field": "TicketCost", "type": "quantitative", "sort": "descending" },
"color": {"field": "id", "type": "nominal"},
"tooltip": {"field": "Name", "type": "nominal"}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"url": "https://sanddance.js.org/sample-data/titanicmaster.tsv",
"format": {
"type": "tsv"
}
},
"transform": [
{
"window": [{
"op": "row_number",
"as": "id"
}]
}
],
"height": 300,
"width": 300,
"mark": "bar",
"encoding": {
"facet": {
"field": "Joined",
"type": "nominal"
},
"y": {
"field": "Age",
"type": "quantitative",
"bin": {
"maxbins": 20
}
},
"x": {
"type": "quantitative",
"field": "id",
"aggregate": "count",
"stack": "normalize",
"axis": {
"format": "%"
}
},
"color": {"field": "id", "type": "nominal"},
"tooltip": {"field": "Name", "type": "nominal"}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"url": "https://sanddance.js.org/sample-data/titanicmaster.tsv",
"format": {
"type": "tsv"
}
},
"transform": [
{
"window": [{
"op": "row_number",
"as": "id"
}]
}
],
"height": 300,
"width": 300,
"mark": "bar",
"encoding": {
"facet": {
"field": "TicketCost",
"type": "quantitative",
"bin": {
"maxbins": 30
},
"columns": 10
},
"y": {
"field": "Age",
"type": "quantitative",
"bin": {
"maxbins": 20
}
},
"x": {
"type": "quantitative",
"field": "id",
"aggregate": "count",
"stack": "normalize",
"axis": {
"format": "%"
}
},
"color": {"field": "id", "type": "nominal"},
"tooltip": {"field": "Name", "type": "nominal"}
}
}
40 changes: 40 additions & 0 deletions docs/tests/specs/input/bar-quantitative-percent-count.vl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"url": "https://sanddance.js.org/sample-data/titanicmaster.tsv",
"format": {
"type": "tsv"
}
},
"transform": [
{
"window": [{
"op": "row_number",
"as": "id"
}]
}
],
"height": 300,
"width": 300,
"mark": "bar",
"encoding": {
"y": {
"field": "Age",
"type": "quantitative",
"bin": {
"maxbins": 20
}
},
"x": {
"type": "quantitative",
"field": "id",
"aggregate": "count",
"stack": "normalize",
"axis": {
"format": "%"
}
},
"color": {"field": "id", "type": "nominal"},
"tooltip": {"field": "Name", "type": "nominal"}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"url": "https://sanddance.js.org/sample-data/titanicmaster.tsv",
"format": {
"type": "tsv"
}
},
"transform": [
{
"window": [{
"op": "row_number",
"as": "id"
}]
}
],
"height": 600,
"width": 300,
"mark": "bar",
"encoding": {
"facet": {
"field": "Joined",
"type": "nominal"
},
"y": {
"field": "Age",
"type": "quantitative",
"bin": {
"maxbins": 20
}
},
"x": {
"type": "quantitative",
"field": "TicketCost",
"stack": "normalize",
"axis": {
"format": "%"
}
},
"order": {"aggregate": "sum", "field": "TicketCost", "type": "quantitative", "sort": "descending" },
"color": {"field": "id", "type": "nominal"},
"tooltip": {"field": "Name", "type": "nominal"}
}
}
Loading

0 comments on commit e4564a9

Please sign in to comment.