Skip to content

Commit ace492b

Browse files
fix: chart color loop (#1041)
1 parent 790ed0c commit ace492b

File tree

2 files changed

+81
-22
lines changed

2 files changed

+81
-22
lines changed

src/components/chart-elements/common/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const constructCategoryColors = (
66
): Map<string, Color | string> => {
77
const categoryColors = new Map<string, Color | string>();
88
categories.forEach((category, idx) => {
9-
categoryColors.set(category, colors[idx]);
9+
categoryColors.set(category, colors[idx % colors.length]);
1010
});
1111
return categoryColors;
1212
};

src/stories/chart-elements/helpers/testData.tsx

+80-21
Original file line numberDiff line numberDiff line change
@@ -1520,48 +1520,107 @@ export const simpleBaseChartData = [
15201520
"Successful Payments": 3000,
15211521
"This is an edge case": 100000000,
15221522
Test: 5000,
1523+
Category1: 1000,
1524+
Category2: 2000,
1525+
Category3: 3000,
1526+
Category4: 4000,
1527+
Category5: 5000,
1528+
Category6: 6000,
1529+
Category7: 7000,
1530+
Category8: 8000,
1531+
Category9: 9000,
1532+
Category10: 10000,
1533+
Category11: 11000,
1534+
Category12: 12000,
1535+
Category13: 13000,
1536+
Category14: 14000,
1537+
Category15: 15000,
1538+
Category16: 16000,
1539+
Category17: 17000,
1540+
Category18: 18000,
1541+
Category19: 19000,
1542+
Category20: 20000,
15231543
},
15241544
{
15251545
month: "Feb 21",
15261546
Sales: 3000,
15271547
"Successful Payments": 2000,
15281548
"This is an edge case": 100000000,
15291549
Test: 5000,
1550+
Category1: 950,
1551+
Category2: 1950,
1552+
Category3: 2950,
1553+
Category4: 3950,
1554+
Category5: 4950,
1555+
Category6: 5950,
1556+
Category7: 6950,
1557+
Category8: 7950,
1558+
Category9: 8950,
1559+
Category10: 9950,
1560+
Category11: 10950,
1561+
Category12: 11950,
1562+
Category13: 12950,
1563+
Category14: 13950,
1564+
Category15: 14950,
1565+
Category16: 15950,
1566+
Category17: 16950,
1567+
Category18: 17950,
1568+
Category19: 18950,
1569+
Category20: 19950,
15301570
},
15311571
{
15321572
month: "Mar 21",
15331573
Sales: 2000,
15341574
"Successful Payments": 1700,
15351575
"This is an edge case": 100000000,
15361576
Test: 5000,
1577+
Category1: 900,
1578+
Category2: 1900,
1579+
Category3: 2900,
1580+
Category4: 3900,
1581+
Category5: 4900,
1582+
Category6: 5900,
1583+
Category7: 6900,
1584+
Category8: 7900,
1585+
Category9: 8900,
1586+
Category10: 9900,
1587+
Category11: 10900,
1588+
Category12: 11900,
1589+
Category13: 12900,
1590+
Category14: 13900,
1591+
Category15: 14900,
1592+
Category16: 15900,
1593+
Category17: 16900,
1594+
Category18: 17900,
1595+
Category19: 18900,
1596+
Category20: 19900,
15371597
},
15381598
{
15391599
month: "Apr 21",
15401600
Sales: 2780,
15411601
"Successful Payments": 2500,
15421602
"This is an edge case": 100000000,
15431603
Test: 5000,
1544-
},
1545-
{
1546-
month: "May 21",
1547-
Sales: 1890,
1548-
"Successful Payments": 1890,
1549-
"This is an edge case": 100000000,
1550-
Test: 5000,
1551-
},
1552-
{
1553-
month: "Jun 21",
1554-
Sales: 2390,
1555-
"Successful Payments": 2000,
1556-
"This is an edge case": 100000000,
1557-
Test: 5000,
1558-
},
1559-
{
1560-
month: "Jul 21",
1561-
Sales: 3490,
1562-
"Successful Payments": 3000,
1563-
"This is an edge case": 100000000,
1564-
Test: 5000,
1604+
Category1: 1000,
1605+
Category2: 2000,
1606+
Category3: 3000,
1607+
Category4: 4000,
1608+
Category5: 5000,
1609+
Category6: 6000,
1610+
Category7: 7000,
1611+
Category8: 8000,
1612+
Category9: 9000,
1613+
Category10: 10000,
1614+
Category11: 11000,
1615+
Category12: 12000,
1616+
Category13: 13000,
1617+
Category14: 14000,
1618+
Category15: 15000,
1619+
Category16: 16000,
1620+
Category17: 17000,
1621+
Category18: 18000,
1622+
Category19: 19000,
1623+
Category20: 20000,
15651624
},
15661625
];
15671626

0 commit comments

Comments
 (0)