@@ -160,6 +160,14 @@ impl<'a> View for ContinuousView<'a> {
160160
161161 let ( x_axis, y_axis) = self . create_axes ( ) ?;
162162
163+ if let Some ( grid) = & self . grid {
164+ view_group. append ( svg_render:: draw_grid (
165+ GridType :: Both ( grid) ,
166+ face_width,
167+ face_height,
168+ ) ) ;
169+ }
170+
163171 // Then, based on those ranges, draw each repr as an SVG
164172 for repr in & self . representations {
165173 let repr_group = repr. to_svg ( & x_axis, & y_axis, face_width, face_height) ;
@@ -170,14 +178,6 @@ impl<'a> View for ContinuousView<'a> {
170178 view_group. append ( svg_render:: draw_x_axis ( & x_axis, face_width) ) ;
171179 view_group. append ( svg_render:: draw_y_axis ( & y_axis, face_height) ) ;
172180
173- if let Some ( grid) = & self . grid {
174- view_group. append ( svg_render:: draw_grid (
175- GridType :: Both ( grid) ,
176- face_width,
177- face_height,
178- ) ) ;
179- }
180-
181181 Ok ( view_group)
182182 }
183183
@@ -364,6 +364,14 @@ impl<'a> View for CategoricalView<'a> {
364364
365365 let ( x_axis, y_axis) = self . create_axes ( ) ?;
366366
367+ if let Some ( grid) = & self . grid {
368+ view_group. append ( svg_render:: draw_grid (
369+ GridType :: HorizontalOnly ( grid) ,
370+ face_width,
371+ face_height,
372+ ) ) ;
373+ }
374+
367375 // Then, based on those ranges, draw each repr as an SVG
368376 for repr in & self . representations {
369377 let repr_group = repr. to_svg ( & x_axis, & y_axis, face_width, face_height) ;
@@ -374,14 +382,6 @@ impl<'a> View for CategoricalView<'a> {
374382 view_group. append ( svg_render:: draw_categorical_x_axis ( & x_axis, face_width) ) ;
375383 view_group. append ( svg_render:: draw_y_axis ( & y_axis, face_height) ) ;
376384
377- if let Some ( grid) = & self . grid {
378- view_group. append ( svg_render:: draw_grid (
379- GridType :: HorizontalOnly ( grid) ,
380- face_width,
381- face_height,
382- ) ) ;
383- }
384-
385385 Ok ( view_group)
386386 }
387387
0 commit comments