File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ function App() {
6969 legend = { 'right' }
7070 legendLabel = "Markets"
7171 />
72- { /* <ScatterPlot
72+ < ScatterPlot
7373 theme = "light"
7474 height = "100%"
7575 width = "100%"
@@ -83,7 +83,7 @@ function App() {
8383 yGrid = { true }
8484 yAxis = "right"
8585 yAxisLabel = "Body Mass"
86- /> */ }
86+ />
8787 </ Container >
8888 ) ;
8989}
Original file line number Diff line number Diff line change @@ -144,10 +144,13 @@ export default function ScatterPlot({
144144 // ********************
145145
146146 // discreteColors must be between 3 and 9, so here we create a range.
147+ const numberOfKeys = Array . from ( keys ) . length ;
147148 const discreteColors =
148- Array . from ( keys ) . length < 4 ? 3 : Math . min ( Array . from ( keys ) . length , 9 ) ;
149- const computedScheme = d3 [ `${ colorScheme } ` ] [ discreteColors ] ;
150- const colorScale = d3 . scaleOrdinal ( Array . from ( computedScheme ) . reverse ( ) ) ;
149+ numberOfKeys < 4 ? 3 : Math . min ( Array . from ( keys ) . length , 9 ) ;
150+ const computedScheme = Array . from (
151+ d3 [ `${ colorScheme } ` ] [ discreteColors ]
152+ ) . reverse ( ) ;
153+ const colorScale = d3 . scaleOrdinal ( computedScheme ) ;
151154 colorScale . domain ( keys ) ;
152155
153156 // ********************
You can’t perform that action at this time.
0 commit comments