File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import PieChart from './charts/PieChart/PieChart';
88import portfolio from '../data/portfolio.json' ;
99import penguins from '../data/penguins.json' ;
1010import fruit from '../data/fruit.json' ;
11+ import skinny_fruit from '../data/skinny_fruit.json' ;
1112
1213import { Container } from './styles/componentStyles' ;
1314
@@ -23,13 +24,14 @@ function App() {
2324 outerRadius = { 240 }
2425 pieLabel = { true }
2526 />
26- { /* <BarChart
27- theme="dark "
27+ < BarChart
28+ theme = "light "
2829 height = "100%"
2930 width = "100%"
30- data={portfolio.slice(5, 13 )}
31+ data = { skinny_fruit . reverse ( ) }
3132 xKey = "date"
3233 yKey = "value"
34+ groupBy = "fruit"
3335 xAxis = "bottom"
3436 yAxis = "right"
3537 yGrid = { true }
@@ -38,7 +40,7 @@ function App() {
3840 legend = { 'bottom' }
3941 tooltipVisible = { true }
4042 />
41- <AreaChart
43+ { /* <AreaChart
4244 theme="dark"
4345 height="100%"
4446 width="100%"
Original file line number Diff line number Diff line change @@ -177,10 +177,13 @@ export default function BarChart({
177177 // Define how the data will drive your design
178178 // ********************
179179
180+ const numberOfKeys = Array . from ( keys ) . length ;
180181 const discreteColors =
181- Array . from ( keys ) . length < 4 ? 3 : Math . min ( Array . from ( keys ) . length , 9 ) ;
182- const computedScheme = d3 [ `${ colorScheme } ` ] [ discreteColors ] ;
183- const colorScale = d3 . scaleOrdinal ( Array . from ( computedScheme ) . reverse ( ) ) ;
182+ numberOfKeys < 4 ? 3 : Math . min ( Array . from ( keys ) . length , 9 ) ;
183+ const computedScheme = Array . from (
184+ d3 [ `${ colorScheme } ` ] [ discreteColors ]
185+ ) . reverse ( ) ;
186+ const colorScale = d3 . scaleOrdinal ( computedScheme ) ;
184187 colorScale . domain ( keys ) ;
185188
186189 // ********************
You can’t perform that action at this time.
0 commit comments