Skip to content

Instantly share code, notes, and snippets.

@sacundim
Created September 27, 2020 06:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sacundim/c1ff5abf247c4c4e0518c487edacd690 to your computer and use it in GitHub Desktop.
Save sacundim/c1ff5abf247c4c4e0518c487edacd690 to your computer and use it in GitHub Desktop.
Ill-formed JSON produced by Altair (NaN at line 111)
{
"config": {
"axis": {
"labelFontSize": 14,
"titleFontSize": 14
},
"header": {
"labelFontSize": 14,
"titleFontSize": 14
},
"legend": {
"labelFontSize": 14,
"titleFontSize": 14
},
"title": {
"align": "center",
"fontSize": 20,
"offset": 15
}
},
"vconcat": [
{
"mark": {
"type": "area",
"opacity": 0.85
},
"encoding": {
"color": {
"type": "nominal",
"field": "tier",
"legend": {
"offset": 5,
"orient": "top",
"titleOrient": "left"
},
"scale": {
"reverse": true,
"scheme": "redyellowgreen"
},
"sort": [
"\u2264 7 d\u00edas",
"\u2264 14 d\u00edas",
"> 14 d\u00edas"
],
"title": "Rengl\u00f3n (d\u00edas)"
},
"order": {
"type": "ordinal",
"field": "tier_order"
},
"tooltip": [
{
"type": "temporal",
"field": "bulletin_date",
"title": "Fecha de bolet\u00edn"
},
{
"type": "nominal",
"field": "tier",
"title": "Rengl\u00f3n"
},
{
"type": "quantitative",
"field": "count",
"format": ",d",
"title": "Resultados en rengl\u00f3n (crudo)"
},
{
"type": "quantitative",
"field": "total",
"format": ",d",
"title": "Total (crudo)"
},
{
"type": "quantitative",
"field": "mean_count",
"format": ".1f",
"title": "Resultados en rengl\u00f3n (promedio 7)"
},
{
"type": "quantitative",
"field": "mean_total",
"format": ".1f",
"title": "Total (promedio 7)"
},
{
"type": "quantitative",
"field": "mean_percent",
"format": ".1%",
"title": "% de total (promedio 7)"
}
],
"x": {
"type": "temporal",
"axis": {
"labels": false,
"ticks": false
},
"field": "bulletin_date",
"title": null
},
"y": {
"type": "quantitative",
"axis": {
"labelExpr": "if(datum.value > 0, datum.label, '')"
},
"field": "mean_count",
"scale": {
"domain": [
0,
NaN
]
},
"title": "Resultados moleculares (promedio 7 d\u00edas)"
}
},
"height": 275,
"transform": [
{
"joinaggregate": [
{
"op": "sum",
"field": "count",
"as": "total"
}
],
"groupby": [
"bulletin_date"
]
},
{
"window": [
{
"op": "mean",
"field": "count",
"as": "mean_count"
},
{
"op": "mean",
"field": "total",
"as": "mean_total"
}
],
"frame": [
-6,
0
],
"groupby": [
"tier"
],
"sort": [
{
"field": "bulletin_date"
}
]
},
{
"calculate": "(datum.count / datum.total)",
"as": "percent"
},
{
"calculate": "(datum.mean_count / datum.mean_total)",
"as": "mean_percent"
}
],
"width": 575
},
{
"mark": {
"type": "area",
"opacity": 0.85
},
"encoding": {
"color": {
"type": "nominal",
"field": "tier",
"legend": {
"offset": 5,
"orient": "top",
"titleOrient": "left"
},
"scale": {
"reverse": true,
"scheme": "redyellowgreen"
},
"sort": [
"\u2264 7 d\u00edas",
"\u2264 14 d\u00edas",
"> 14 d\u00edas"
],
"title": "Rengl\u00f3n (d\u00edas)"
},
"order": {
"type": "ordinal",
"field": "tier_order"
},
"tooltip": [
{
"type": "temporal",
"field": "bulletin_date",
"title": "Fecha de bolet\u00edn"
},
{
"type": "nominal",
"field": "tier",
"title": "Rengl\u00f3n"
},
{
"type": "quantitative",
"field": "count",
"format": ",d",
"title": "Resultados en rengl\u00f3n (crudo)"
},
{
"type": "quantitative",
"field": "total",
"format": ",d",
"title": "Total (crudo)"
},
{
"type": "quantitative",
"field": "mean_count",
"format": ".1f",
"title": "Resultados en rengl\u00f3n (promedio 7)"
},
{
"type": "quantitative",
"field": "mean_total",
"format": ".1f",
"title": "Total (promedio 7)"
},
{
"type": "quantitative",
"field": "mean_percent",
"format": ".1%",
"title": "% de total (promedio 7)"
}
],
"x": {
"type": "temporal",
"field": "bulletin_date",
"title": "Fecha de bolet\u00edn"
},
"y": {
"type": "quantitative",
"axis": {
"format": "%",
"labelExpr": "if(datum.value < 1.0, datum.label, '')"
},
"field": "mean_count",
"stack": "normalize",
"title": "% rengl\u00f3n"
}
},
"height": 75,
"transform": [
{
"joinaggregate": [
{
"op": "sum",
"field": "count",
"as": "total"
}
],
"groupby": [
"bulletin_date"
]
},
{
"window": [
{
"op": "mean",
"field": "count",
"as": "mean_count"
},
{
"op": "mean",
"field": "total",
"as": "mean_total"
}
],
"frame": [
-6,
0
],
"groupby": [
"tier"
],
"sort": [
{
"field": "bulletin_date"
}
]
},
{
"calculate": "(datum.count / datum.total)",
"as": "percent"
},
{
"calculate": "(datum.mean_count / datum.mean_total)",
"as": "mean_percent"
}
],
"width": 575
}
],
"data": {
"name": "data-a47f2e164dee7368a593114a3f33493c"
},
"spacing": 5,
"$schema": "https://vega.github.io/schema/vega-lite/v4.8.1.json",
"datasets": {
"data-a47f2e164dee7368a593114a3f33493c": [
{
"bulletin_date": "2020-07-18T00:00:00",
"tier": "0-3",
"tier_order": 0,
"count": 787
},
{
"bulletin_date": "2020-07-18T00:00:00",
"tier": "4-7",
"tier_order": 4,
"count": 54
},
{
"bulletin_date": "2020-07-18T00:00:00",
"tier": "8-14",
"tier_order": 8,
"count": 36
},
{
"bulletin_date": "2020-07-18T00:00:00",
"tier": "> 14",
"tier_order": 14,
"count": 8
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment