@@ -37,7 +37,7 @@ export type BarStackProps = {
37
37
/* DEFAULT STYLING */
38
38
const axisColor = '#679DCA' ;
39
39
const background = "#242529" ;
40
- const defaultMargin = { top : 40 , right : 0 , bottom : 0 , left : 0 } ;
40
+ const defaultMargin = { top : 40 , right : 30 , bottom : 0 , left : 35 } ;
41
41
const tooltipStyles = {
42
42
...defaultStyles ,
43
43
minWidth : 60 ,
@@ -136,7 +136,7 @@ const colorScale = scaleOrdinal<CityName, string>({
136
136
137
137
// setting max dimensions and scale ranges
138
138
if ( width < 10 ) return null ;
139
- const xMax = width ;
139
+ const xMax = width - margin . left - margin . right
140
140
const yMax = height - margin . top - 100 ;
141
141
snapshotIdScale . rangeRound ( [ 0 , xMax ] ) ;
142
142
renderingScale . range ( [ yMax , 0 ] ) ;
@@ -165,7 +165,7 @@ renderingScale.range([yMax, 0]);
165
165
strokeOpacity = { 0.1 }
166
166
xOffset = { snapshotIdScale . bandwidth ( ) / 2 }
167
167
/>
168
- < Group top = { margin . top } >
168
+ < Group top = { margin . top } left = { margin . left } >
169
169
< BarStack < snapshot , CityName >
170
170
data = { data }
171
171
keys = { keys }
@@ -182,6 +182,7 @@ renderingScale.range([yMax, 0]);
182
182
height = { bar . height }
183
183
width = { bar . width }
184
184
fill = { bar . color }
185
+ /* TIP TOOL EVENT HANDLERS */
185
186
onClick = { ( ) => {
186
187
if ( events ) alert ( `clicked: ${ JSON . stringify ( bar ) } ` ) ;
187
188
} }
@@ -208,6 +209,7 @@ renderingScale.range([yMax, 0]);
208
209
</ Group >
209
210
< AxisBottom
210
211
top = { yMax + margin . top }
212
+ left = { margin . left }
211
213
scale = { snapshotIdScale }
212
214
stroke = { axisColor }
213
215
tickStroke = { axisColor }
0 commit comments