流行の統計情報の可視化

1.基本はじめに

この作品は、コースに属し 春2020 | Sクラス
運用要件 流行の統計情報の可視化
ジョブズゴール 機能特徴を実現するためのWeb技術を使用して冬の最初のプロトタイプジョブを結合
ペア学生ID 221 701 215(共産)、221 701 222(チェンアップ)
ジョブのテキスト クリックします
その他の参考文献 「法の構築。」

2.実績展

インタフェースショーへの最初のデータ2020年1月25日のとして誕生統計の日:

国が強調され、対応するメッセージ:

蓄積した情報をスイッチに蓄積された情報]ボタンをクリックすると、湖北省累積数が増加:

日付情報を入力するには、流行のマップを更新します:

3接合の説明に記載された方法。

4.設計と実装のプロセス:

中国マップを達成し、ハイライト1.echart
トップ統計を実現2.
データクラスはファイルからデータを読み込み、作成3.
4.データクラスデータのロードマップ

5コード説明

1.Data.getTotalは()国に関する情報を返します。

public Vector<Integer> getTotal() {
    Vector<Integer> total = new Vector<>();
    Status status = map.get("全国");
    int a[] = status.getNum();
    for (int i = 0; i < 4; i++) {
        total.add(a[i]);
    }
    Random random=new Random(1000);
    total.insertElementAt(random.nextInt(100),2);
    total.insertElementAt(a[0] + a[2] + a[3],3);

    return total;
}

日付を計算する前に2.Data.getUpdate()、第1の電流getTotal保存の結果。

public Vector<Integer> getUpdate() {
    Vector<Integer> total = new Vector<>();
    String string = command[6];
    String cmd[] = command;
    Calendar c = Calendar.getInstance();
    java.util.Date date = null;
    try {
        date = new SimpleDateFormat("yy-MM-dd").parse(string);
    } catch (Exception e) {
        e.printStackTrace();
    }
    c.setTime(date);
    int day = c.get(Calendar.DATE);
    c.set(Calendar.DATE, day - 1);
    String dayBefore = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime());
    cmd[6] = dayBefore;
    DocFormatter docFormatter = new DocFormatter(cmd);
    Excute ex = new Excute(docFormatter);
    ex.run();
    Map<String, Status> map1 = ex.getMap();
    Status s1 = map1.get("全国");
    int a[] = s1.getNum();
    Vector<Integer> temp = new Vector<>();
    for (int i = 0; i < 4; i++) {
        temp.add(a[i]);
    }
    Random random = new Random(1000);
    temp.insertElementAt(random.nextInt(100), 2);
    temp.insertElementAt(a[0] + a[2] + a[3], 3);
    for (int i = 0; i < 6; i++) {
        total.add(vec.get(i) - temp.get(i));
    }

    return total;
}

3.echartsは、中国のマップをロード

var myChart = echarts.init(document.getElementById('main'));
   var optionMap = {  
            backgroundColor: '#FFFFFF',  
            title: {  
               text: '',  
                subtext: '',
                x:'center'  
            },  
            tooltip : {  
                trigger: 'item'  
            },  
            
            //左侧小导航图标
            visualMap: {  
                show : true,  
                x: 'left',  
                y: 'center',  
                splitList: [   
                    {start: 10000},{start: 1000, end: 9999},  
                    {start: 100, end: 999},{start: 10, end: 99},  
                    {start: 1, end: 9},{start: 0, end: 0},  
                ],  
                color: ['#690902', '#b61004', '#eb2517','#ef6056', '#ed9791', '#ffffff']  
            },  
           
            //配置属性
            series: [{  
                name: '确诊',  
                type: 'map',  
                mapType: 'china',   
                roam: true,  
                label: {  
                    normal: {  
                        show: true  //省份名称  
                    },  
                    emphasis: {  
                        show: false  
                    }  
                },  
                data:mydata  //数据
            } 
               ]  
        };  
myChart.clear();
    //使用制定的配置项和数据显示图表
myChart.setOption(optionMap);

4.コールデータフィルデータの方法

<% 
            String dates=(String)request.getAttribute("date");

            String[] command = { "list", "-log", "E:\\echarts\\log\\", "-out", "F:\\holiday\\output1.txt", "-date",
            "2020-01-25" };
            if(dates!=null){
                command[6]=dates;
            }           
            Data data = new Data(command); 
            
        %>  
        var mydate=<%=data.getTotal()%>;
        var mydata=<%=data.getUpdate()%>;

6.考え方と収穫

おすすめ

転載: www.cnblogs.com/yangmingwei969/p/12482579.html