新体温上报系统阶段三(2)

package com.example.tiwen;


import android.app.Activity;
import android.os.Bundle;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

public class zhexian extends Activity {

    private RecyclerView recyclerView;
    List<Integer> data;
    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.zhexian);

        recyclerView = findViewById(R.id.recycler_view);

        LinearLayoutManager manager = new LinearLayoutManager(this);
        manager.setOrientation(LinearLayoutManager.HORIZONTAL);
        recyclerView.setLayoutManager(manager);

        data = new ArrayList<>();
        data.add(36);
        data.add(37);
        data.add(38);
        data.add(37);
        data.add(36);
        data.add(38);
        data.add(36);
        Hour_Adapter adapter = new Hour_Adapter(this,data);
        recyclerView.setAdapter(adapter);

    }
}

 

 引用js文件

test2.xml文件

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>echarts中国地图</title>
    <style>
        .centerItem {
            width: 750px;
            height: 640px;
            margin: 60px auto 0 auto;
        }
    </style>
</head>

<body>
    <!-- 中国地图展示 -->
    <div id="mapBox" class="centerItem"></div>

    <!-- 引入相关文件 -->
    <script src="jquery-1.11.1.min.js"></script>
    <script src="echarts.min.js"></script>
    <script src="china.js"></script>
    <script>
        // 基于准备好的dom,初始化echarts实例
        var mapBoxEchart = echarts.init(document.getElementById('mapBox'));

        // 指定相关的配置项和数据
        var mapBoxOption = {
            tooltip: {
                formatter: function (params) {
                    var a = '2人填报';
                    var b = '20人填报';
                    var c = '1人填报';
                    var d = '2人填报';
                    var e = '1人填报';
                    var hb = '华北大区';
                    var db = '东北大区';
                    var hd = '华东大区';
                    var hz = '华中大区';
                    var xb = '西北大区';
                    var xn = '西南大区';
                    var hbq=["山东"];
                    var hbq2=["黑龙江"];
                    var hbq3=["河北"];
                    var hbq4=["山西"];
                    var hbq5=["辽宁"];
                    var dbq = ["北京", "天津", "吉林", "广西","内蒙古",
                     "江苏", "安徽","浙江","福建","上海","湖北", "湖南", "河南", "江西",
                    "宁夏", "新疆", "青海", "陕西", "甘肃","四川", "云南", "贵州", "西藏", "重庆"];
                    Array.prototype.Exists = function (v) { var b = false; for (var i = 0; i < this.length; i++) { if (this[i] == v) { b = true; break; } } return b; };
                    if (hbq.Exists(params.name)){
                        // params.name = hb + '<br/>' + params.name;
                        var info = '<p style="font-size:16px;text-align:center;padding:0 20px;">'+a+ '<span class="span_name" style="display:block;margin-top:10px;">' + params.name + '</span>' + '</p>'
                        return info;
                    }
                         if (hbq2.Exists(params.name)){
                        // params.name = hb + '<br/>' + params.name;
                        var info = '<p style="font-size:16px;text-align:center;padding:0 20px;">'+c+ '<span class="span_name" style="display:block;margin-top:10px;">' + params.name + '</span>' + '</p>'
                        return info;
                    }
                     if (hbq3.Exists(params.name)){
                        // params.name = hb + '<br/>' + params.name;
                        var info = '<p style="font-size:16px;text-align:center;padding:0 20px;">'+b+ '<span class="span_name" style="display:block;margin-top:10px;">' + params.name + '</span>' + '</p>'
                        return info;
                    }
                     if (hbq4.Exists(params.name)){
                        // params.name = hb + '<br/>' + params.name;
                        var info = '<p style="font-size:16px;text-align:center;padding:0 20px;">'+e+ '<span class="span_name" style="display:block;margin-top:10px;">' + params.name + '</span>' + '</p>'
                        return info;
                    }
                     if (hbq5.Exists(params.name)){
                        // params.name = hb + '<br/>' + params.name;
                        var info = '<p style="font-size:16px;text-align:center;padding:0 20px;">'+d+ '<span class="span_name" style="display:block;margin-top:10px;">' + params.name + '</span>' + '</p>'
                        return info;
                    }
                    if (dbq.Exists(params.name)) {
                        // params.name = hb + '<br/>' + params.name;
                        var info = '<p style="font-size:16px;text-align:center;padding:0 20px;">' + b + '<span class="span_name" style="display:block;margin-top:10px;">' + params.name + '</span>' + '</p>'
                        return info;
                    }
                    else{
                        var info = '<p style="font-size:16px;text-align:center;">' + params.name +b+ '</p>'
                        return info;
                    }
                },
                backgroundColor: "#ff7f50",//提示标签背景颜色
                textStyle: { color: "#fff" } //提示标签字体颜色
            },
            series: [{
                type: 'map',
                mapType: 'china',
                label: {
                    normal: {
                        show: true, //显示省份标签
                        textStyle: {
                            color: "rgb(51, 51, 51)"
                        } //省份标签字体颜色
                    },
                    emphasis: { //对应的鼠标悬浮效果
                        show: false,
                        textStyle: {
                            color: "#800080"
                        }
                    }
                },
                aspectScale: 0.75,
                zoom: 1.2,
                itemStyle: {
                    normal: {
                        borderWidth: .5, //区域边框宽度
                        borderColor: '#4b0082', //区域边框颜色
                        areaColor: "#ffefd5", //区域颜色
                    },
                    emphasis: {
                        borderWidth: .5,
                        borderColor: '#4b0082',
                        areaColor: "#ffdead",
                    }
                },
                data: [
                    { name: '北京', selected: false, value: 1 },
                    { name: '天津', selected: false, value: 2 },
                    { name: '上海', selected: false, value: 3 },
                    { name: '重庆', selected: false, value: 4 },
                    { name: '河北', selected: false, value: 5 },
                    { name: '河南', selected: false, value: 6 },
                    { name: '云南', selected: false, value: 7 },
                    { name: '辽宁', selected: false, value: 8 },
                    { name: '黑龙江', selected: false, value: 9 },
                    { name: '湖南', selected: false, value: 10 },
                    { name: '安徽', selected: false, value: 11 },
                    { name: '山东', selected: false, value: 12 },
                    { name: '新疆', selected: false, value: 13 },
                    { name: '江苏', selected: false, value: 14 },
                    { name: '浙江', selected: false, value: 15 },
                    { name: '江西', selected: false, value: 16 },
                    { name: '湖北', selected: false, value: 17 },
                    { name: '广西', selected: false, value: 18 },
                    { name: '甘肃', selected: false, value: 19 },
                    { name: '山西', selected: false, value: 20 },
                    { name: '内蒙古', selected: false, value: 21 },
                    { name: '陕西', selected: false, value: 22 },
                    { name: '吉林', selected: false, value: 23 },
                    { name: '福建', selected: false, value: 24 },
                    { name: '贵州', selected: false, value: 25 },
                    { name: '广东', selected: false, value: 26 },
                    { name: '青海', selected: false, value: 27 },
                    { name: '西藏', selected: false, value: 28 },
                    { name: '四川', selected: false, value: 29 },
                    { name: '宁夏', selected: false, value: 30 },
                    { name: '海南', selected: false, value: 31 },
                    { name: '台湾', selected: false, value: 32 },
                    { name: '香港', selected: false, value: 33 },
                    { name: '澳门', selected: false, value: 34 },
                    { name: '南海诸岛', selected: false, value: 35 }
                ] //各省地图颜色数据依赖value
            }],
            dataRange: {
                x: '-1000 px', //图例横轴位置
                y: '-1000 px', //图例纵轴位置
                splitList: [
                    { start: 1, end: 1, label: '北京', color: '#e7e7e7' },
                    { start: 2, end: 2, label: '天津', color: '#e7e7e7' },
                    { start: 3, end: 3, label: '上海', color: '#e7e7e7' },
                    { start: 4, end: 4, label: '重庆', color: '#e7e7e7' },
                    { start: 5, end: 5, label: '河北', color: '#FF0000'},
                    { start: 6, end: 6, label: '河南', color: '#e7e7e7' },
                    { start: 7, end: 7, label: '云南', color: '#e7e7e7' },
                    { start: 8, end: 8, label: '辽宁', color: '#FA5858'  },
                    { start: 9, end: 9, label: '黑龙江', color: '#f5b1b2' },
                    { start: 10, end: 10, label: '湖南', color: '#e7e7e7' },
                    { start: 11, end: 11, label: '安徽', color: '#e7e7e7' },
                    { start: 12, end: 12, label: '山东', color: '#FA5858' },
                    { start: 13, end: 13, label: '新疆', color: '#e7e7e7' },
                    { start: 14, end: 14, label: '江苏', color: '#e7e7e7' },
                    { start: 15, end: 15, label: '浙江', color: '#e7e7e7' },
                    { start: 16, end: 16, label: '江西', color: '#e7e7e7' },
                    { start: 17, end: 17, label: '湖北', color: '#e7e7e7' },
                    { start: 18, end: 18, label: '广西', color: '#e7e7e7' },
                    { start: 19, end: 19, label: '甘肃', color: '#e7e7e7' },
                    { start: 20, end: 20, label: '山西', color: '#f5b1b2' },
                    { start: 21, end: 21, label: '内蒙古', color: '#e7e7e7' },
                    { start: 22, end: 22, label: '陕西', color: '#e7e7e7' },
                    { start: 23, end: 23, label: '吉林', color: '#e7e7e7' },
                    { start: 24, end: 24, label: '福建', color: '#e7e7e7' },
                    { start: 25, end: 25, label: '贵州', color: '#e7e7e7' },
                    { start: 26, end: 26, label: '广东', color: '#e7e7e7' },
                    { start: 27, end: 27, label: '青海', color: '#e7e7e7' },
                    { start: 28, end: 28, label: '西藏', color: '#e7e7e7' },
                    { start: 29, end: 29, label: '四川', color: '#e7e7e7' },
                    { start: 30, end: 30, label: '宁夏', color: '#e7e7e7' },
                    { start: 31, end: 31, label: '海南', color: '#e7e7e7' },
                    { start: 32, end: 32, label: '台湾', color: '#e7e7e7' },
                    { start: 33, end: 33, label: '香港', color: '#e7e7e7' },
                    { start: 34, end: 34, label: '澳门', color: '#e7e7e7' },
                    { start: 35, end: 35, label: '南海诸岛', color: '#e7e7e7' }
                ]
            }, //各省地图颜色;start:值域开始值;end:值域结束值;label:图例名称;color:自定义颜色值;
        };
        // 使用制定的配置项和数据显示图表
        mapBoxEchart.setOption(mapBoxOption);
        // echart图表自适应
        window.addEventListener("resize", function () {
            mapBoxEchart.resize();
        });
    </script>

</body>

</html>

 

posted @ 2021-03-23 20:13  陈涵  阅读(49)  评论(0编辑  收藏  举报