<commit_before>/*
    绘制NWPC的数值预报系统运行时间线
 */


var svg_size = {
    'width': 1800,
    'height': 800
};

var chart_option = {
    'start_point': {
        'x': 250,
        'y': 30
    },
    'suite': {
        'interval': 30,
        'bar_height': 20
    }
};

function draw_legend(){
    var legend_svg = d3.select("#time-line-container-legend")
        .append("svg")
        .attr('width', svg_size.width)
        .attr('height', 50);

    var legend_bar = legend_svg.append('g')
        .attr('transform', 'translate('+ chart_option.start_point.x +',0)');

    var legend_enter = legend_bar.selectAll('.legend-item')
        .data(color_domain)
        .enter()
        .append('g')
        .classed('legend-item', true);

    legend_enter.append('rect')
        .attr('x', function(d,i){
            return 120*i;
        })
        .attr('y', function(d,i){
            return 5;
        })
        .attr('width', 20)
        .attr('height', 20)
        .style('fill', function(d,i){
            return color_scale(d)
        });

    legend_enter.append('text')
        .attr('x', function(d,i){
            return 120*i+25;
        })
        .attr('y', function(d,i){
            return 15;
        })
        .attr("dominant-baseline", "central")
        .text(function(d,i){
            return d
        });

    var legend_bar_label = legend_bar.append('text')
        .attr('x', -15)
        .attr('y', 25)
        .attr("dominant-baseline", "central")
        .attr("text-anchor", "end");
    legend_bar_label
        .append('tspan')
        .attr('x', -15)
        .attr('dy', -20)
        .text("队列名称(图中数字为并行");
    legend_bar_label
        .append('tspan')
        .attr('x', -15)
        .attr('dy', 20)
        .text("队列使用的CPU核心数)")
}

draw_legend();


var svg = d3.select("#time-line-container")
    .append("svg")
    .attr('width', svg_size.width)
    .attr('height', svg_size.height);

var current_time = new Date();

var start_hour = d3.timeDay(current_time);
console.log(start_hour);

var next_date = d3.timeDay.offset(start_hour, 1);

var end_hour = d3.timeHour.offset(next_date, 0);

var x_scale = d3.scaleTime()
    .domain([start_hour, end_hour])
    .range([0, svg_size.width - 2*chart_option.start_point.x]);<commit_msg>Change text in legend bar.<commit_after>/*
    绘制NWPC的数值预报系统运行时间线
 */


var svg_size = {
    'width': 1800,
    'height': 800
};

var chart_option = {
    'start_point': {
        'x': 250,
        'y': 30
    },
    'suite': {
        'interval': 30,
        'bar_height': 20
    }
};

function draw_legend(){
    var legend_svg = d3.select("#time-line-container-legend")
        .append("svg")
        .attr('width', svg_size.width)
        .attr('height', 50);

    var legend_bar = legend_svg.append('g')
        .attr('transform', 'translate('+ chart_option.start_point.x +',0)');

    var legend_enter = legend_bar.selectAll('.legend-item')
        .data(color_domain)
        .enter()
        .append('g')
        .classed('legend-item', true);

    legend_enter.append('rect')
        .attr('x', function(d,i){
            return 120*i;
        })
        .attr('y', function(d,i){
            return 5;
        })
        .attr('width', 20)
        .attr('height', 20)
        .style('fill', function(d,i){
            return color_scale(d)
        });

    legend_enter.append('text')
        .attr('x', function(d,i){
            return 120*i+25;
        })
        .attr('y', function(d,i){
            return 15;
        })
        .attr("dominant-baseline", "central")
        .text(function(d,i){
            return d
        });

    var legend_bar_label = legend_bar.append('text')
        .attr('x', -15)
        .attr('y', 15)
        .attr("dominant-baseline", "central")
        .attr("text-anchor", "end")
        .text("队列名称");


    legend_bar.append('text')
        .attr('x', 0)
        .attr('y', 40)
        .attr("dominant-baseline", "central")
        .attr("text-anchor", "start")
        .text("图中数字为并行队列使用的CPU核心数");
}

draw_legend();


var svg = d3.select("#time-line-container")
    .append("svg")
    .attr('width', svg_size.width)
    .attr('height', svg_size.height);

var current_time = new Date();

var start_hour = d3.timeDay(current_time);
console.log(start_hour);

var next_date = d3.timeDay.offset(start_hour, 1);

var end_hour = d3.timeHour.offset(next_date, 0);

var x_scale = d3.scaleTime()
    .domain([start_hour, end_hour])
    .range([0, svg_size.width - 2*chart_option.start_point.x]);
{'fraction_non_alphanumeric': 0.1797727779015371, 'fraction_numerical': 0.02383604366228559, 'mean_word_length': 2.164200140944327, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1840871', 'n_tokens_mistral': 1705, 'n_tokens_neox': 1604, 'n_words': 268}