<commit_before>import { svg } from 'd3';

export default function rangePolygon (chart){

    var area = svg.area()
        .x(function(d){ 
            return chart.x(d["TIME"])
        }) 
        .y0(function(d){ 
            var lbornlo = d['STNRLO'];
            return lbornlo !== 'NA' ? chart.y(+lbornlo) : 0
        })
        .y1(function(d) { 
            var lbornrhi = d['STNRHI'];
            return lbornrhi !== 'NA' ? chart.y(+lbornrhi) : 0
        });

    var dRow = chart.filtered_data[0];

    var myRows = chart.x_dom.slice().map(m => {
        return {
            STNRLO: dRow[chart.config.normal_col_low],
            STNRHI: dRow[chart.config.normal_col_high],
            TIME: m
        };
    });
    //remove what is there now
    chart.svg.select('.norms').remove();
    //add new
    chart.svg.append("path")
        .datum(myRows)
        .attr("class","norms")
        .attr("fill","blue")
        .attr("fill-opacity",0.1)
        .attr("d",area);
}<commit_msg>Pull normal ranges from raw data rather than filtered data as filtered data defaults to last mark drawn.<commit_after>import { svg } from 'd3';

export default function rangePolygon (chart){

    var area = svg.area()
        .x(function(d){ 
            return chart.x(d["TIME"])
        }) 
        .y0(function(d){ 
            var lbornlo = d['STNRLO'];
            return lbornlo !== 'NA' ? chart.y(+lbornlo) : 0
        })
        .y1(function(d) { 
            var lbornrhi = d['STNRHI'];
            return lbornrhi !== 'NA' ? chart.y(+lbornrhi) : 0
        });

    var dRow = chart.raw_data[0];

    var myRows = chart.x_dom.slice().map(m => {
        return {
            STNRLO: dRow[chart.config.normal_col_low],
            STNRHI: dRow[chart.config.normal_col_high],
            TIME: m
        };
    });
    //remove what is there now
    chart.svg.select('.norms').remove();
    //add new
    chart.svg.append("path")
        .datum(myRows)
        .attr("class","norms")
        .attr("fill","blue")
        .attr("fill-opacity",0.1)
        .attr("d",area);
}

{'fraction_non_alphanumeric': 0.16256632899179932, 'fraction_numerical': 0.007718282682103232, 'mean_word_length': 1.848901098901099, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5183611', 'n_tokens_mistral': 711, 'n_tokens_neox': 689, 'n_words': 137}