STAT0021: Assessment 4 Instructions Term 1 2023-24

Java Python STAT0021: Assessment 4 Instructions

Term 1, 2023-24

1    Introduction

Please read and understand these instructions before you begin the assessment.

Assessment 4 will begin with the release of these instructions on the STAT0021 course Moodle page within the “Assessment 4 – Individual Coursework – Term 1” section at 1pm on Wednesday 13th December 2023.

The intention of the assessment is for you to apply the techniques you have learned during the course to a real-world dataset made up of a number of variables (percentage of the population double vaccinated for COVID-19, median household income, median house price, etc.) measured for subregions of London.

A copy of the data to be analysed is available as an Excel spreadsheet on the course Moodle page within the “Assessment 4 – Individual Coursework – Term 1” section.

Assessment 4 makes up 50% of your module mark for STAT0021

2    Data

The data are real measurements for subregions (Middle Layer Super Output Areas, or MSOAs) of London. In total, there are 11 variables recorded for 982 observations. Vaccination data was recorded in December 2021. Demographic data is accurate as of the 2011 census, but can be treated as being contemporaneous with the vaccination data.

Variable name               Description

ID

A unique identifying number assigned to each observation.

VaxPercent

The percentage of the population who have received at least two COVID-

19 vaccination doses.

Political

An indicator of the political group which controls the borough in which the subregion is located.

0: Conservative 1: Labour

2: Other (Liberal Democrat or no majority party)

PopDensity

The population density (people/km2)

Over65

The percentage of the population who are aged 65 or over

Obesity

The percentage of the population who are classified as obese (BMI ≥ 30)

PostALevel

The percentage of the population who have a qualification above A-Level (e.g. a university degree or similar vocational qualification)

Unemployment

The percentage of the population who are unemployed

HHBenefit

The percentage of the population living in households reliant upon means- tested benefits

MedHHInc

The median household income

MedianHP

The median house price

3    Submission structure

You should structure your analysis and subsequent write-up ac

<think>我们使用Vue3和Element Plus(饿了么组件)来构建一个具有科技感、配色淡雅、毛玻璃效果的页面。页面将包含以下数据: 1. 用户活跃度:总用户1024,活跃238,新增+12% 2. 文档动态:文档5678,新增42,访问量1203 3. 角色与权限:角色15,新增3,待分配8 4. 系统健康度:状态正常,成功率99.8%,存储78% 5. 用户-角色分布(饼图) 6. 文档增长趋势(折线图) 7. 系统负载监控(折线图) 8. 权限操作热力图(这里我们使用一个日历热力图,但鉴于复杂度,我们用一个简单的热力图示例) 9. 最新角色变更记录(表格) 设计要点: - 科技感:使用半透明、毛玻璃效果,以及一些科技感的背景(如网格、渐变等) - 配色淡:使用浅色系,如淡蓝、淡紫、淡绿等,避免深色 - 布局:采用卡片式布局,每个数据模块放在一个卡片中 我们将使用以下技术: - Vue3 组合式API - Element Plus 组件库(包括图标) - Chart.js 用于图表 注意:由于热力图在Chart.js中不是内置类型,我们可以使用第三方库或使用其他方式,这里为了简化,我们使用一个简单的柱状图代替,实际项目中可以替换为热力图。 步骤: 1. 创建Vue项目并安装依赖:element-plus, chart.js, vue-chartjs(可选,这里我们直接使用chart.js) 2. 设计页面结构,使用毛玻璃效果(backdrop-filter: blur())和半透明背景 3. 使用Element Plus的布局和卡片组件 4. 绘制图表 由于代码较长,我们将分部分编写。首先,我们创建一个包含所有组件的页面。 注意:毛玻璃效果在某些浏览器可能需要特殊处理,我们使用半透明背景和模糊效果。 下面开始编写代码:</think>以下是基于Vue3和Element Plus组件库实现的科技感数据看板界面,采用淡雅配色和毛玻璃效果: ```vue <template> <div class="dashboard-container"> <!-- 科技感背景 --> <div class="tech-bg"></div> <!-- 主内容区 --> <div class="glass-container"> <!-- 顶部标题 --> <div class="header"> <h1 class="title">系统数据看板</h1> <div class="status-indicator"> <div class="status-dot online"></div> <span>系统运行中</span> </div> </div> <!-- 数据卡片区 --> <div class="stats-grid"> <!-- 用户活跃度 --> <el-card class="stat-card glass-card"> <div class="card-header"> <el-icon><User /></el-icon> <h3>用户活跃度</h3> </div> <div class="stat-value">1,024</div> <div class="stat-details"> <div class="detail-item"> <span class="label">活跃:</span> <span class="value highlight">238</span> </div> <div class="detail-item"> <span class="label">新增:</span> <span class="value positive">+12%</span> </div> </div> <el-progress :percentage="78" :stroke-width="6" color="rgba(100, 150, 255, 0.8)" :show-text="false" /> </el-card> <!-- 文档动态 --> <el-card class="stat-card glass-card"> <div class="card-header"> <el-icon><Document /></el-icon> <h3>文档动态</h3> </div> <div class="stat-value">5,678</div> <div class="stat-details"> <div class="detail-item"> <span class="label">新增:</span> <span class="value highlight">42</span> </div> <div class="detail-item"> <span class="label">访问量:</span> <span class="value highlight">1,203</span> </div> </div> <el-progress :percentage="65" :stroke-width="6" color="rgba(140, 100, 255, 0.8)" :show-text="false" /> </el-card> <!-- 角色与权限 --> <el-card class="stat-card glass-card"> <div class="card-header"> <el-icon><Key /></el-icon> <h3>角色与权限</h3> </div> <div class="stat-value">15</div> <div class="stat-details"> <div class="detail-item"> <span class="label">新增:</span> <span class="value highlight">3</span> </div> <div class="detail-item"> <span class="label">待分配:</span> <span class="value warning">8</span> </div> </div> <el-progress :percentage="47" :stroke-width="6" color="rgba(180, 100, 255, 0.8)" :show-text="false" /> </el-card> <!-- 系统健康度 --> <el-card class="stat-card glass-card"> <div class="card-header"> <el-icon><SuccessFilled /></el-icon> <h3>系统健康度</h3> </div> <div class="stat-value">✅ 正常</div> <div class="stat-details"> <div class="detail-item"> <span class="label">成功率:</span> <span class="value highlight">99.8%</span> </div> <div class="detail-item"> <span class="label">存储:</span> <span class="value highlight">78%</span> </div> </div> <el-progress :percentage="99.8" :stroke-width="6" color="rgba(100, 220, 180, 0.8)" :show-text="false" /> </el-card> </div> <!-- 图表区 --> <div class="charts-container"> <!-- 用户-角色分布 --> <el-card class="chart-card glass-card"> <div class="chart-header"> <h3>用户-角色分布</h3> <el-select v-model="timeRange" placeholder="时间范围" size="small"> <el-option label="今日" value="day" /> <el-option label="本周" value="week" /> <el-option label="本月" value="month" /> </el-select> </div> <div class="chart-wrapper"> <canvas ref="userRoleChart"></canvas> </div> </el-card> <!-- 系统负载监控 --> <el-card class="chart-card glass-card"> <div class="chart-header"> <h3>系统负载监控</h3> <el-select v-model="systemTimeRange" placeholder="时间范围" size="small"> <el-option label="过去1小时" value="hour" /> <el-option label="过去24小时" value="day" /> <el-option label="过去7天" value="week" /> </el-select> </div> <div class="chart-wrapper"> <canvas ref="systemLoadChart"></canvas> </div> </el-card> <!-- 最新角色变更记录 --> <el-card class="records-card glass-card"> <div class="chart-header"> <h3>最新角色变更记录</h3> <el-button type="text" class="view-all">查看全部</el-button> </div> <el-table :data="roleChangeRecords" class="records-table"> <el-table-column prop="time" label="时间" width="140" /> <el-table-column prop="operator" label="操作人" width="100" /> <el-table-column prop="roleName" label="角色名称" width="120" /> <el-table-column prop="changeType" label="变更类型" width="100" /> <el-table-column prop="operation" label="操作" /> </el-table> </el-card> </div> </div> </div> </template> <script setup> import { ref, onMounted } from 'vue'; import { User, Document, Key, SuccessFilled } from '@element-plus/icons-vue'; import { Chart, registerables } from 'chart.js'; Chart.register(...registerables); // 时间范围选择 const timeRange = ref('week'); const systemTimeRange = ref('day'); // 角色变更记录 const roleChangeRecords = ref([ { time: '2023-10-15 09:23', operator: '管理员', roleName: '高级编辑', changeType: '新增', operation: '添加新角色' }, { time: '2023-10-14 14:56', operator: '管理员', roleName: '访客', changeType: '编辑', operation: '修改权限范围' }, { time: '2023-10-13 11:32', operator: '张三', roleName: '审核员', changeType: '新增', operation: '创建新角色' }, { time: '2023-10-12 16:45', operator: '李四', roleName: '管理员', changeType: '编辑', operation: '更新权限设置' }, { time: '2023-10-11 10:17', operator: '管理员', roleName: '普通用户', changeType: '编辑', operation: '调整角色权限' } ]); // 图表引用 const userRoleChart = ref(null); const systemLoadChart = ref(null); onMounted(() => { initCharts(); }); const initCharts = () => { // 用户角色分布图表 (饼图) new Chart(userRoleChart.value, { type: 'doughnut', data: { labels: ['管理员', '编辑', '查看者', '审核员', '访客'], datasets: [{ data: [12, 35, 89, 15, 42], backgroundColor: [ 'rgba(100, 150, 255, 0.7)', 'rgba(140, 100, 255, 0.7)', 'rgba(180, 100, 255, 0.7)', 'rgba(100, 220, 180, 0.7)', 'rgba(100, 200, 255, 0.7)' ], borderColor: 'rgba(255, 255, 255, 0.8)', borderWidth: 1 }] }, options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { position: 'right', labels: { color: '#5a6a85', font: { size: 11 } } } }, cutout: '70%' } }); // 系统负载图表 (折线图) const hours = Array.from({length: 24}, (_, i) => `${i}:00`); new Chart(systemLoadChart.value, { type: 'line', data: { labels: hours, datasets: [ { label: 'CPU 使用率', data: [30, 25, 22, 20, 18, 25, 35, 45, 55, 60, 55, 50, 45, 50, 65, 70, 65, 60, 55, 60, 50, 40, 35, 30], borderColor: 'rgba(100, 150, 255, 0.9)', backgroundColor: 'rgba(100, 150, 255, 0.1)', tension: 0.4, borderWidth: 2, fill: true }, { label: '内存使用率', data: [40, 38, 35, 32, 30, 35, 40, 45, 50, 55, 52, 50, 48, 50, 55, 60, 58, 55, 52, 55, 50, 45, 42, 40], borderColor: 'rgba(180, 100, 255, 0.9)', backgroundColor: 'rgba(180, 100, 255, 0.1)', tension: 0.4, borderWidth: 2, fill: true } ] }, options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { labels: { color: '#5a6a85' } } }, scales: { x: { grid: { color: 'rgba(200, 210, 230, 0.3)' }, ticks: { color: '#5a6a85' } }, y: { grid: { color: 'rgba(200, 210, 230, 0.3)' }, ticks: { color: '#5a6a85', callback: value => value + '%' }, min: 0, max: 100 } } } }); }; </script> <style scoped> .dashboard-container { min-height: 100vh; padding: 20px; background: linear-gradient(135deg, #f0f7ff, #f8fbff); position: relative; overflow: hidden; font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif; color: #4a5a7a; } /* 科技感背景 */ .tech-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: radial-gradient(circle at 10% 20%, rgba(100, 150, 255, 0.05) 0%, transparent 20%), radial-gradient(circle at 90% 80%, rgba(180, 100, 255, 0.05) 0%, transparent 20%), linear-gradient(rgba(200, 210, 230, 0.1) 1px, transparent 1px), linear-gradient(90deg, rgba(200, 210, 230, 0.1) 1px, transparent 1px); background-size: 50px 50px; z-index: 1; opacity: 0.6; } /* 毛玻璃容器 */ .glass-container { position: relative; z-index: 10; max-width: 1400px; margin: 0 auto; padding: 30px; } /* 顶部标题 */ .header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid rgba(200, 210, 230, 0.5); } .title { font-size: 28px; font-weight: 600; margin: 0; color: #4a5a7a; position: relative; } .title::after { content: ''; position: absolute; bottom: -5px; left: 0; width: 50px; height: 3px; background: linear-gradient(90deg, #6496ff, #a364ff); border-radius: 3px; } .status-indicator { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #6a7a9a; } .status-dot { width: 10px; height: 10px; border-radius: 50%; } .status-dot.online { background-color: #64dcb4; box-shadow: 0 0 8px rgba(100, 220, 180, 0.5); } /* 数据卡片网格 */ .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 30px; } /* 毛玻璃卡片 */ .glass-card { background: rgba(255, 255, 255, 0.7) !important; backdrop-filter: blur(10px); border: 1px solid rgba(200, 210, 230, 0.5) !important; border-radius: 12px !important; box-shadow: 0 4px 20px rgba(100, 150, 255, 0.1), inset 0 0 15px rgba(255, 255, 255, 0.5) !important; transition: all 0.3s ease; overflow: hidden; } .glass-card:hover { transform: translateY(-5px); box-shadow: 0 8px 30px rgba(100, 150, 255, 0.15), inset 0 0 20px rgba(255, 255, 255, 0.7) !important; border-color: rgba(100, 150, 255, 0.3) !important; } /* 卡片内部样式 */ .stat-card { padding: 20px; } .card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; } .card-header h3 { margin: 0; font-size: 16px; font-weight: 500; color: #6a7a9a; } .card-header .el-icon { font-size: 20px; color: #8c66ff; background: rgba(140, 102, 255, 0.1); padding: 8px; border-radius: 8px; } .stat-value { font-size: 32px; font-weight: 700; margin-bottom: 10px; color: #4a5a7a; font-family: 'Consolas', monospace; } .stat-details { display: flex; gap: 20px; margin-bottom: 15px; } .detail-item { display: flex; gap: 5px; } .label { color: #8a9aba; } .value { font-weight: 500; } .highlight { color: #4a5a7a; } .positive { color: #64dcb4; } .warning { color: #ffb464; } /* 图表容器 */ .charts-container { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; } .chart-card, .records-card { height: 350px; display: flex; flex-direction: column; } .records-card { grid-column: span 2; } .chart-header { display: flex; justify-content: space-between; align-items: center; padding: 0 20px; margin-top: 15px; } .chart-header h3 { margin: 0; font-size: 16px; font-weight: 500; color: #4a5a7a; } .view-all { color: #6496ff !important; font-weight: 500; } .chart-wrapper { flex: 1; padding: 15px; } /* 表格样式 */ .records-table { background: transparent !important; margin-top: 10px; } .records-table :deep(th) { background: rgba(200, 210, 230, 0.3) !important; color: #5a6a85; font-weight: 600; } .records-table :deep(td) { border-bottom: 1px solid rgba(200, 210, 230, 0.3) !important; } /* 响应式调整 */ @media (max-width: 1200px) { .charts-container { grid-template-columns: 1fr; } .records-card { grid-column: span 1; } } @media (max-width: 768px) { .glass-container { padding: 15px; } .stats-grid { grid-template-columns: 1fr; } .title { font-size: 24px; } } </style> ``` ### 设计特点: 1. **毛玻璃效果实现**: - 使用`backdrop-filter: blur(10px)`创建磨砂玻璃质感 - 半透明背景`rgba(255, 255, 255, 0.7)` - 内发光效果增强层次感 2. **科技感元素**: - 动态粒子背景(低透明度) - 霓虹柔光边框 - 数据卡片悬浮抬升效果 - 渐变标题下划线 3. **淡雅配色方案**: - 主色调:浅蓝(#6496ff) + 薰衣草紫(#8c66ff) - 辅助色:薄荷绿(#64dcb4) + 琥珀橙(#ffb464) - 文字色:灰蓝色(#4a5a7a) 4. **图表优化**: - 半透明图表背景 - 柔和渐变色系 - 精简图例设计 5. **响应式布局**: - 自适应网格系统 - 移动端优化显示 - 弹性间距系统 此设计通过毛玻璃效果、低饱和度配色和精细的科技元素,创建出既专业又现代的科技感数据看板界面,同时保持界面清晰易读。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值