async function createLineGraph(data) {
    let dimensions = defaultDimensions;
    dimensions = addBounds(dimensions);

    clearGraphs();

    // These are the functions for this function to access X and Y values
    function yAccessor(d) {
        return d["StartDay"];
    }

    function xAccessor(d) {
        return parseDate(d["Day"]);
    }

    const graph = appendGraph(dimensions);
    const wrapper = graph[0];
    const bounds = graph[1];

    // Create the scales based the data to be graphed
    const yScale = d3.scaleLinear()
        .domain(d3.extent(data, yAccessor))
        .range([dimensions.boundedHeight, 0]);
    console.log(d3.extent(data, yAccessor));
    
    const xScale = d3.scaleTime()
        .domain(d3.extent(data, xAccessor))
        .range([0, dimensions.boundedWidth]);
    
    // Draws data
    const lineGenerator = d3.line()
            .x(d => xScale(xAccessor(d)))
            .y(d => yScale(yAccessor(d)));
    const line = bounds.append("path")
            // d defines the shape to be drawn
            .attr("d", lineGenerator(data))
            .attr("fill", "none")
            .attr("stroke", "cornflowerblue")
            .attr("stroke-width", 3);

    // Draws peripherals
    drawAxes(yScale, xScale, bounds, dimensions);
}
// An asynchronous function that, given an array of objects, creates a line graph
An asynchronous function that, given an array of objects, creates a line graph
An asynchronous function that given an array of objects creates a line graph
async function createLineGraph(data) {
    let dimensions = defaultDimensions;
    dimensions = addBounds(dimensions);
    clearGraphs();
    function yAccessor(d) {
        return d["StartDay"];
    }
    function xAccessor(d) {
        return parseDate(d["Day"]);
    }
    const graph = appendGraph(dimensions);
    const wrapper = graph[0];
    const bounds = graph[1];
    const yScale = d3.scaleLinear()
        .domain(d3.extent(data, yAccessor))
        .range([dimensions.boundedHeight, 0]);
    console.log(d3.extent(data, yAccessor));
    const xScale = d3.scaleTime()
        .domain(d3.extent(data, xAccessor))
        .range([0, dimensions.boundedWidth]);
    const lineGenerator = d3.line()
            .x(d => xScale(xAccessor(d)))
            .y(d => yScale(yAccessor(d)));
    const line = bounds.append("path")
            .attr("d", lineGenerator(data))
            .attr("fill", "none")
            .attr("stroke", "cornflowerblue")
            .attr("stroke-width", 3);
    drawAxes(yScale, xScale, bounds, dimensions);
}
async function createLineGraph ( data ) { let dimensions = defaultDimensions ; dimensions = addBounds ( dimensions ) ; clearGraphs ( ) ; function yAccessor ( d ) { return d [ "StartDay" ] ; } function xAccessor ( d ) { return parseDate ( d [ "Day" ] ) ; } const graph = appendGraph ( dimensions ) ; const wrapper = graph [ 0 ] ; const bounds = graph [ 1 ] ; const yScale = d3 . scaleLinear ( ) . domain ( d3 . extent ( data , yAccessor ) ) . range ( [ dimensions . boundedHeight , 0 ] ) ; console . log ( d3 . extent ( data , yAccessor ) ) ; const xScale = d3 . scaleTime ( ) . domain ( d3 . extent ( data , xAccessor ) ) . range ( [ 0 , dimensions . boundedWidth ] ) ; const lineGenerator = d3 . line ( ) . x ( d => xScale ( xAccessor ( d ) ) ) . y ( d => yScale ( yAccessor ( d ) ) ) ; const line = bounds . append ( "path" ) . attr ( "d" , lineGenerator ( data ) ) . attr ( "fill" , "none" ) . attr ( "stroke" , "cornflowerblue" ) . attr ( "stroke-width" , 3 ) ; drawAxes ( yScale , xScale , bounds , dimensions ) ; }
An asynchronous function that, given an array of objects, creates a line graph
An asynchronous function that given an array of objects creates a line graph
// These are the functions for this function to access X and Y values // Create the scales based the data to be graphed // Draws data // d defines the shape to be drawn // Draws peripherals