<commit_before><div id="${id}">
    <svg style="height:${height}px; width:${width}px; background:${background};"></svg>
    <div style="background:${background}">
        <span style="${button}">SVG</span>
        <span style="${button}">PNG</span>
    </div>
</div>

<script>
nv.addGraph(function() {
    var chart = nv.models.${chart}();

    if ("${chart}" == "scatterChart") {
        chart
            .showDistX(true)
            .showDistY(true);
    }

    chart
        .color(d3.scale.category10().range());

    chart.xAxis.tickFormat(d3.format("${xFormat}"))
    chart.yAxis.tickFormat(d3.format("${yFormat}"))
    chart.xAxis.axisLabel("${xLabel}")
    chart.yAxis.axisLabel("${yLabel}")

    d3.select('#${id} svg')
        .datum(${data})
        .call(chart);

    nv.utils.windowResize(chart.update);

    return chart;
});

var buttons = document.getElementById('${id}').children[1].children;
buttons[0].onclick = function() {
    var svg = document.getElementById('${id}').children[0];
    var svg = (new XMLSerializer).serializeToString(svg);
    window.URL = window.webkitURL || window.URL;

    var bb = new Blob([svg], {type:'text/svg'});

    var a = document.createElement('a');
    a.download = 'chart.svg';
    a.href = window.URL.createObjectURL(bb);
    a.textContent = 'Save!';
    a.dataset.downloadurl = ['text/svg', a.download, a.href].join(':');

    document.getElementById('${id}').children[1].appendChild(a);

    a.onclick = function(e) {
        setTimeout(function() {
            window.URL.revokeObjectURL(a.href);
        }, 1500);
        a.remove();
    };

    a.click();
};

buttons[1].onclick = function() {
    var svg = document.getElementById('${id}').children[0];
    saveSvgAsPng(svg, "diagram.png", 1);
}; 
</script><commit_msg>added png save for chart (png renders properly, unlike SVG which has bugs<commit_after><div id="${id}">
    <svg style="height:${height}px; width:${width}px; background:${background};"></svg>
    <div style="background:${background}">
        <span style="${button}">SVG</span>
        <span style="${button}">PNG</span>
    </div>
</div>

<script>
nv.addGraph(function() {
    var chart = nv.models.${chart}();

    if ("${chart}" == "scatterChart") {
        chart
            .showDistX(true)
            .showDistY(true);
    }

    chart
        .color(d3.scale.category10().range());

    chart.xAxis.tickFormat(d3.format("${xFormat}"))
    chart.yAxis.tickFormat(d3.format("${yFormat}"))
    chart.xAxis.axisLabel("${xLabel}")
    chart.yAxis.axisLabel("${yLabel}")

    d3.select('#${id} svg')
        .datum(${data})
        .call(chart);

    nv.utils.windowResize(chart.update);

    return chart;
});

var buttons = document.getElementById('${id}').children[1].children;
buttons[0].onclick = function() {
    var svg = document.getElementById('${id}').children[0];
    var svg = (new XMLSerializer).serializeToString(svg);
    window.URL = window.webkitURL || window.URL;

    var bb = new Blob([svg], {type:'text/svg'});

    var a = document.createElement('a');
    a.download = 'chart.svg';
    a.href = window.URL.createObjectURL(bb);
    a.textContent = 'Save!';
    a.dataset.downloadurl = ['text/svg', a.download, a.href].join(':');

    document.getElementById('${id}').children[1].appendChild(a);

    a.onclick = function(e) {
        setTimeout(function() {
            window.URL.revokeObjectURL(a.href);
        }, 1500);
        a.remove();
    };

    a.click();
};

buttons[1].onclick = function() {
    var svg = document.getElementById('${id}').children[0];
    saveSvgAsPng(svg, "chart.png", 4);
}; 
</script>
{'fraction_non_alphanumeric': 0.20706791827719492, 'fraction_numerical': 0.009387078961899503, 'mean_word_length': 3.2176949941792783, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6233929', 'n_tokens_mistral': 1242, 'n_tokens_neox': 1209, 'n_words': 187}