<commit_before>var lizDataviz = function() {

    var dv = {
        'config' : null,
        'plots': []
    };

    function getPlots(){
        if(!dv.config.layers)
            return false;
        for( var i in dv.config.layers) {
            getPlot(
                dv.config.layers[i]
            );
        }
    }

    function getPlot(plot_config){
        var lparams = {
            'request': 'getPlot',
            'plot_id': plot_config.plot_id
        };
        $.getJSON(datavizConfig.url,
            lparams,
            function(json){
                if( 'errors' in json ){
                    console.log('Dataviz configuration error');
                    console.log(json.errors);
                    return false;
                }
                if( !json.data || json.data.length < 1)
                    return false;
                dv.plots.push(json);

                var html = '<h3><span class="title">';
                html+= '<span class="icon"></span>&nbsp;';
                html+= '<span class="text">'+plot_config.title+'</span>';
                html+= '</span></h3>';
                html+= '<div class="menu-content">';
                html+= '  <p>'+plot_config.abstract+'</p>';
                var dataviz_plot_id = 'dataviz_plot_' + plot_config.plot_id;
                html+= '  <div id="'+dataviz_plot_id+'"></div>';
                html+= '</div>';

                $('#dataviz-content').append(html);
                var plot = buildPlot(dataviz_plot_id, json);

            }
        );
    }

    function buildPlot(id, conf){
        Plotly.newPlot(id, conf.data, conf.layout);
        lizMap.events.on({
            dockopened: function(e) {
                if ( e.id == 'dataviz' ) {
                    resizePlot(id);
                }
            }
        });
        lizMap.events.on({
            rightdockopened: function(e) {
                if ( e.id == 'dataviz' ) {
                    resizePlot(id);
                }<commit_msg>Dataviz - Use a div as container for each chart<commit_after>var lizDataviz = function() {

    var dv = {
        'config' : null,
        'plots': []
    };

    function getPlots(){
        if(!dv.config.layers)
            return false;
        for( var i in dv.config.layers) {
            getPlot(
                dv.config.layers[i]
            );
        }
    }

    function getPlot(plot_config){
        var lparams = {
            'request': 'getPlot',
            'plot_id': plot_config.plot_id
        };
        $.getJSON(datavizConfig.url,
            lparams,
            function(json){
                if( 'errors' in json ){
                    console.log('Dataviz configuration error');
                    console.log(json.errors);
                    return false;
                }
                if( !json.data || json.data.length < 1)
                    return false;
                dv.plots.push(json);


                var dataviz_plot_id = 'dataviz_plot_' + plot_config.plot_id;

                var html = '';
                html+= '<div class="dataviz_plot_container"  id="'+dataviz_plot_id+'_container">'
                html+= '<h3><span class="title">';
                html+= '<span class="icon"></span>&nbsp;';
                html+= '<span class="text">'+plot_config.title+'</span>';
                html+= '</span></h3>';
                html+= '<div class="menu-content">';
                html+= '  <p>'+plot_config.abstract+'</p>';
                html+= '  <div id="'+dataviz_plot_id+'"></div>';
                html+= '</div>';
                html+= '</div>';

                $('#dataviz-content').append(html);
                var plot = buildPlot(dataviz_plot_id, json);

            }
        );
    }

    function buildPlot(id, conf){
        Plotly.newPlot(id, conf.data, conf.layout);
        lizMap.events.on({
            dockopened: function(e) {
                if ( e.id == 'dataviz' ) {
                    resizePlot(id);
                }
            }
        });
        lizMap.events.on({
            rightdockopened: function(e) {
                if ( e.id == 'dataviz' ) {
                    resizePlot(id);
                }
{'fraction_non_alphanumeric': 0.14523809523809525, 'fraction_numerical': 0.0014285714285714286, 'mean_word_length': 1.2671343766864545, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 33, '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': '2341469', 'n_tokens_mistral': 1267, 'n_tokens_neox': 1170, 'n_words': 213}