fn to_text(&self, face_width: u32, face_height: u32) -> Result<String> {
        let (x_axis, y_axis) = self.create_axes()?;

        let (y_axis_string, longest_y_label_width) =
            text_render::render_y_axis_strings(&y_axis, face_height);

        let (x_axis_string, start_offset) = text_render::render_x_axis_strings(&x_axis, face_width);

        let left_gutter_width = std::cmp::max(
            longest_y_label_width as i32 + 3,
            start_offset.wrapping_neg(),
        ) as u32;

        let view_width = face_width + 1 + left_gutter_width + 1;
        let view_height = face_height + 4;

        let blank: Vec<String> = (0..view_height)
            .map(|_| (0..view_width).map(|_| ' ').collect())
            .collect();
        let mut view_string = blank.join("\n");

        for repr in &self.representations {
            let face_string = repr.to_text(&x_axis, &y_axis, face_width, face_height);
            view_string =
                text_render::overlay(&view_string, &face_string, left_gutter_width as i32 + 1, 0);
        }

        let view_string = text_render::overlay(
            &view_string,
            &y_axis_string,
            left_gutter_width as i32 - 2 - longest_y_label_width,
            0,
        );
        let view_string = text_render::overlay(
            &view_string,
            &x_axis_string,
            left_gutter_width as i32,
            face_height as i32,
        );

        Ok(view_string)
    }
/**
    Create a text rendering of the view
    */
Create a text rendering of the view
Create a text rendering of the view
fn to_text(&self, face_width: u32, face_height: u32) -> Result<String> {
        let (x_axis, y_axis) = self.create_axes()?;
        let (y_axis_string, longest_y_label_width) =
            text_render::render_y_axis_strings(&y_axis, face_height);
        let (x_axis_string, start_offset) = text_render::render_x_axis_strings(&x_axis, face_width);
        let left_gutter_width = std::cmp::max(
            longest_y_label_width as i32 + 3,
            start_offset.wrapping_neg(),
        ) as u32;
        let view_width = face_width + 1 + left_gutter_width + 1;
        let view_height = face_height + 4;
        let blank: Vec<String> = (0..view_height)
            .map(|_| (0..view_width).map(|_| ' ').collect())
            .collect();
        let mut view_string = blank.join("\n");
        for repr in &self.representations {
            let face_string = repr.to_text(&x_axis, &y_axis, face_width, face_height);
            view_string =
                text_render::overlay(&view_string, &face_string, left_gutter_width as i32 + 1, 0);
        }
        let view_string = text_render::overlay(
            &view_string,
            &y_axis_string,
            left_gutter_width as i32 - 2 - longest_y_label_width,
            0,
        );
        let view_string = text_render::overlay(
            &view_string,
            &x_axis_string,
            left_gutter_width as i32,
            face_height as i32,
        );
        Ok(view_string)
    }
fn to_text ( & self , face_width : u32 , face_height : u32 ) -> Result < String > { let ( x_axis , y_axis ) = self . create_axes ( ) ? ; let ( y_axis_string , longest_y_label_width ) = text_render :: render_y_axis_strings ( & y_axis , face_height ) ; let ( x_axis_string , start_offset ) = text_render :: render_x_axis_strings ( & x_axis , face_width ) ; let left_gutter_width = std :: cmp :: max ( longest_y_label_width as i32 + 3 , start_offset . wrapping_neg ( ) , ) as u32 ; let view_width = face_width + 1 + left_gutter_width + 1 ; let view_height = face_height + 4 ; let blank : Vec < String > = ( 0 .. view_height ) . map ( | _ | ( 0 .. view_width ) . map ( | _ | ' ' ) . collect ( ) ) . collect ( ) ; let mut view_string = blank . join ( " \n " ) ; for repr in & self . representations { let face_string = repr . to_text ( & x_axis , & y_axis , face_width , face_height ) ; view_string = text_render :: overlay ( & view_string , & face_string , left_gutter_width as i32 + 1 , 0 ) ; } let view_string = text_render :: overlay ( & view_string , & y_axis_string , left_gutter_width as i32 - 2 - longest_y_label_width , 0 , ) ; let view_string = text_render :: overlay ( & view_string , & x_axis_string , left_gutter_width as i32 , face_height as i32 , ) ; Ok ( view_string ) }
Create a text rendering of the view
Create a text rendering of the view
&self
face_width
u32
face_height
u32
&self
face_width
u32
face_height
u32