Skip to content

Commit 37f3227

Browse files
author
Robert Crocker
committed
Updated the pie color again to reflect to correct colors based on sorted data.
1 parent 37a04b4 commit 37f3227

File tree

3 files changed

+2
-12
lines changed

3 files changed

+2
-12
lines changed

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function App() {
1717
<Container className="app">
1818
<PieChart
1919
theme="dark"
20-
data={fruit}
20+
data={fruit.sort((a, b) => a.value - b.value)}
2121
label="label"
2222
value="value"
2323
legend="top-left"

src/charts/LineChart/LineChart.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,6 @@ export default function LineChart({
159159
// ********************
160160

161161
const numberOfKeys = Array.from(keys).length;
162-
// let discreteColors = 0;
163-
// let computedScheme: string[];
164-
// if (numberOfKeys > 3) {
165-
// discreteColors = Math.min(Array.from(keys).length, 9);
166-
// computedScheme = d3[`${colorScheme}`][discreteColors];
167-
// } else {
168-
169-
// }
170162
const discreteColors =
171163
numberOfKeys < 4 ? 3 : Math.min(Array.from(keys).length, 9);
172164
const computedScheme = Array.from(

src/charts/PieChart/PieChart.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ export default function PieChart({
148148
const numberOfKeys = Array.from(keys).length;
149149
const discreteColors =
150150
numberOfKeys < 4 ? 3 : Math.min(Array.from(keys).length, 9);
151-
const computedScheme = Array.from(
152-
d3[`${colorScheme}`][discreteColors]
153-
).reverse();
151+
const computedScheme = d3[`${colorScheme}`][discreteColors];
154152
const colorScale = d3.scaleOrdinal(computedScheme);
155153
colorScale.domain(keys);
156154

0 commit comments

Comments
 (0)