Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions app/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,7 @@

## Color

Do not set colors, scales, or ranges for a categorical or single-series encoding — just map a field to the color channel to distinguish series and leave the palette to the defaults.

For a numeric value mapped to color (any mark colored by a number), set the color scale's `scheme` only when the value's semantic meaning has a color convention worth matching; otherwise leave it to the default. For example:

- Temperature → blue for cold, red for hot: use "redblue" or "redyellowblue" (add `"reverse": true` if low and high land on the wrong ends).
- A quantity that diverges around a meaningful midpoint → a diverging scheme such as "redblue" or "blueorange" with the scale's `domainMid` set to that midpoint.

When you do name a scheme, use a real Vega scheme name — never one from another library. Prefer colorblind-safe schemes.
Never set any color-related property — no `scale`, `scheme`, `sort`, `range`, or explicit color value — on any encoding, mark, or config, whether the field is categorical, quantitative, or there's only one series. Just map the field to the color channel and leave everything else about its color to the frontend's defaults.

## Number formatting

Expand Down Expand Up @@ -106,7 +99,7 @@
"projection": {"type": "mercator"},
"mark": "geoshape",
"encoding": {
"color": {"field": "valor", "type": "quantitative", "title": "…", "scale": {"scheme": "yellowgreenblue"}},
"color": {"field": "valor", "type": "quantitative", "title": "…"},
"tooltip": [{"field": "properties.name", "type": "nominal", "title": "Estado"}, {"field": "valor", "type": "quantitative"}]
},
}
Expand All @@ -117,7 +110,7 @@
"projection": {"type": "mercator"},
"mark": "geoshape",
"encoding": {
"color": {"field": "valor", "type": "quantitative", "title": "…", "scale": {"scheme": "yellowgreenblue"}},
"color": {"field": "valor", "type": "quantitative", "title": "…"},
"tooltip": [{"field": "properties.name", "type": "nominal", "title": "Município"}, {"field": "valor", "type": "quantitative"}]
},
}
Expand Down