Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix/viz colors #981

Merged
merged 2 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
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
22 changes: 11 additions & 11 deletions docs/configuration-customizations.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ For example, we can override main color and use [Tableu10](https://www.tableau.c
```yaml
customizaiton:
visualizationColors:
main: #829aa3
main: "#829aa3"
series:
- #4e79a7
- #f28e2c
- #e15759
- #76b7b2
- #59a14f
- #edc949
- #af7aa1
- #ff9da7
- #9c755f
- #bab0ab
- "#4e79a7"
- "#f28e2c"
- "#e15759"
- "#76b7b2"
- "#59a14f"
- "#edc949"
- "#af7aa1"
- "#ff9da7"
- "#9c755f"
- "#bab0ab"
```

By default, Turnilo uses 10 different colors for series. But it is possible to define more and Turnilo will adjust necessary split limits.
Expand Down
9 changes: 7 additions & 2 deletions src/common/utils/rules/split-adjustments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ import { thread } from "../functional/functional";

export function adjustColorSplit(split: Split, dimension: Dimension, series: SeriesList, visualizationColors: VisualizationColors): Split {
const colorsCount = visualizationColors.series.length;
const availableLimits = new Set([
// TODO: This magic 5 will disappear in #756
5,
Math.min(split.limit, colorsCount),
colorsCount
]);
return thread(
split,
adjustSort(dimension, series),
// TODO: This magic 5 will disappear in #756
adjustFiniteLimit([5, colorsCount], colorsCount)
adjustFiniteLimit([...availableLimits], colorsCount)
);
}

Expand Down