pub fn to_svg(&self) -> Result<svg::Document> {
        let (width, height) = self.dimensions;
        let mut document = Document::new().set("viewBox", (0, 0, width, height));

        let x_margin = 120; // should actually depend on y-axis label font size
        let y_margin = 60;
        let x_offset = 0.6 * f64::from(x_margin);
        let y_offset = 0.6 * f64::from(y_margin);

        // TODO put multiple views in correct places
        for &view in &self.views {
            let view_group = view
                .to_svg(f64::from(width - x_margin), f64::from(height - y_margin))?
                .set(
                    "transform",
                    format!("translate({}, {})", x_offset, f64::from(height) - y_offset),
                );
            document.append(view_group);
        }
        Ok(document)
    }
/**
    Render the plot to an svg document
    */
Render the plot to an svg document
Render the plot to an svg document
pub fn to_svg(&self) -> Result<svg::Document> {
        let (width, height) = self.dimensions;
        let mut document = Document::new().set("viewBox", (0, 0, width, height));
        let x_margin = 120; // should actually depend on y-axis label font size
        let y_margin = 60;
        let x_offset = 0.6 * f64::from(x_margin);
        let y_offset = 0.6 * f64::from(y_margin);
        // TODO put multiple views in correct places
        for &view in &self.views {
            let view_group = view
                .to_svg(f64::from(width - x_margin), f64::from(height - y_margin))?
                .set(
                    "transform",
                    format!("translate({}, {})", x_offset, f64::from(height) - y_offset),
                );
            document.append(view_group);
        }
        Ok(document)
    }
pub fn to_svg ( & self ) -> Result < svg :: Document > { let ( width , height ) = self . dimensions ; let mut document = Document :: new ( ) . set ( " " , ( 0 , 0 , width , height ) ) ; let x_margin = 120 ; // should actually depend on y-axis label font size let y_margin = 60 ; let x_offset = 0.6 * f64 :: from ( x_margin ) ; let y_offset = 0.6 * f64 :: from ( y_margin ) ; // TODO put multiple views in correct places for & view in & self . views { let view_group = view . to_svg ( f64 :: from ( width - x_margin ) , f64 :: from ( height - y_margin ) ) ? . set ( " " , format ! ( " " x_offset f64 from ( height ) y_offset ) , ) ; document . append ( view_group ) ; } Ok ( document ) }
Render the plot to an svg document
Render the plot to an svg document
&self
&self