fn to_svg(&self, face_width: f64, face_height: f64) -> Result<svg::node::element::Group> {
        let mut view_group = svg::node::element::Group::new();

        let (x_axis, y_axis) = self.create_axes()?;

        let (legend_x, mut legend_y) = (face_width - 100., -face_height);
        if let Some(grid) = &self.grid {
            view_group.append(svg_render::draw_grid(
                GridType::Both(grid),
                face_width,
                face_height,
            ));
        }

        // Then, based on those ranges, draw each repr as an SVG
        for repr in &self.representations {
            let repr_group = repr.to_svg(&x_axis, &y_axis, face_width, face_height);
            view_group.append(repr_group);

            if let Some(legend_group) = repr.legend_svg() {
                view_group.append(legend_group.set(
                    "transform",
                    format!("translate({}, {})", legend_x, legend_y),
                ));
                legend_y += 18.;
            }
        }

        // Add in the axes
        view_group.append(svg_render::draw_x_axis(&x_axis, face_width));
        view_group.append(svg_render::draw_y_axis(&y_axis, face_height));

        Ok(view_group)
    }
/**
    Create an SVG rendering of the view
    */
Create an SVG rendering of the view
Create an SVG rendering of the view
fn to_svg(&self, face_width: f64, face_height: f64) -> Result<svg::node::element::Group> {
        let mut view_group = svg::node::element::Group::new();
        let (x_axis, y_axis) = self.create_axes()?;
        let (legend_x, mut legend_y) = (face_width - 100., -face_height);
        if let Some(grid) = &self.grid {
            view_group.append(svg_render::draw_grid(
                GridType::Both(grid),
                face_width,
                face_height,
            ));
        }
        // Then, based on those ranges, draw each repr as an SVG
        for repr in &self.representations {
            let repr_group = repr.to_svg(&x_axis, &y_axis, face_width, face_height);
            view_group.append(repr_group);
            if let Some(legend_group) = repr.legend_svg() {
                view_group.append(legend_group.set(
                    "transform",
                    format!("translate({}, {})", legend_x, legend_y),
                ));
                legend_y += 18.;
            }
        }
        // Add in the axes
        view_group.append(svg_render::draw_x_axis(&x_axis, face_width));
        view_group.append(svg_render::draw_y_axis(&y_axis, face_height));
        Ok(view_group)
    }
fn to_svg ( & self , face_width : f64 , face_height : f64 ) -> Result < svg :: node :: element :: Group > { let mut view_group = svg :: node :: element :: Group :: new ( ) ; let ( x_axis , y_axis ) = self . create_axes ( ) ? ; let ( legend_x , mut legend_y ) = ( face_width - 100. , - face_height ) ; if let Some ( grid ) = & self . grid { view_group . append ( svg_render :: draw_grid ( GridType :: Both ( grid ) , face_width , face_height , ) ) ; } // Then, based on those ranges, draw each repr as an SVG for repr in & self . representations { let repr_group = repr . to_svg ( & x_axis , & y_axis , face_width , face_height ) ; view_group . append ( repr_group ) ; if let Some ( legend_group ) = repr . legend_svg ( ) { view_group . append ( legend_group . set ( " " , format ! ( " " legend_x legend_y ) , ) ) ; legend_y += 18. ; } } // Add in the axes view_group . append ( svg_render :: draw_x_axis ( & x_axis , face_width ) ) ; view_group . append ( svg_render :: draw_y_axis ( & y_axis , face_height ) ) ; Ok ( view_group ) }
Create an SVG rendering of the view
Create an SVG rendering of the view
&self
face_width
f64
face_height
f64
&self
face_width
f64
face_height
f64