ca1793b4c0
- 趋势组件 trend-chart 新增 chartType(line/bar),line 模式用内联 SVG 渲染折线+渐变面积(无 canvas) - 记录页个人最佳趋势改用折线图,峰值信息移到图表下方对称高亮块显示最佳趋势产生日期 - 修复1: linePoints 漏存绝对坐标 y 导致运行时 toFixed 崩溃 - 修复2: 折线模式漏渲染数据点数值(valueText),现圆点上方显示且 0 值不显示
172 lines
3.0 KiB
Plaintext
172 lines
3.0 KiB
Plaintext
.trend-chart {
|
|
/* top room so the value labels above tall bars aren't clipped */
|
|
padding-top: 32rpx;
|
|
}
|
|
|
|
.trend-bars {
|
|
display: flex;
|
|
align-items: flex-end;
|
|
height: 220rpx;
|
|
gap: 14rpx;
|
|
}
|
|
|
|
.trend-bar-col {
|
|
flex: 1;
|
|
height: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: flex-end;
|
|
}
|
|
|
|
.trend-bar {
|
|
width: 100%;
|
|
position: relative;
|
|
border-radius: 8rpx 8rpx 0 0;
|
|
background: linear-gradient(180deg, var(--primary), var(--primary-light));
|
|
min-height: 6rpx;
|
|
transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
|
}
|
|
|
|
.trend-bar.zero {
|
|
background: var(--border);
|
|
min-height: 4rpx;
|
|
}
|
|
|
|
.trend-bar.highlight {
|
|
box-shadow: 0 0 14rpx rgba(var(--primary-rgb), 0.5);
|
|
}
|
|
|
|
.trend-chart.peak .trend-bars {
|
|
height: 156rpx;
|
|
}
|
|
|
|
.trend-chart.peak .trend-bar {
|
|
width: 12rpx;
|
|
margin: 0 auto;
|
|
min-height: 8rpx;
|
|
border-radius: 999rpx;
|
|
}
|
|
|
|
.trend-chart.peak .trend-bar::after {
|
|
content: '';
|
|
position: absolute;
|
|
top: -8rpx;
|
|
left: -4rpx;
|
|
width: 20rpx;
|
|
height: 20rpx;
|
|
border-radius: 50%;
|
|
background: var(--primary);
|
|
}
|
|
|
|
.trend-chart.peak .trend-bar.zero::after {
|
|
background: var(--border);
|
|
}
|
|
|
|
/* value caption floats above the bar so it never eats into bar height */
|
|
.trend-bar-value {
|
|
position: absolute;
|
|
top: -26rpx;
|
|
left: 0;
|
|
right: 0;
|
|
text-align: center;
|
|
font-size: 16rpx;
|
|
color: var(--text-secondary);
|
|
line-height: 1;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.trend-labels {
|
|
display: flex;
|
|
margin-top: 12rpx;
|
|
gap: 14rpx;
|
|
}
|
|
|
|
.trend-bar-label {
|
|
flex: 1;
|
|
text-align: center;
|
|
font-size: 20rpx;
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.trend-bar-label.highlight {
|
|
color: var(--primary);
|
|
font-weight: 600;
|
|
}
|
|
|
|
/* ---- Line mode ---- */
|
|
.trend-chart.line {
|
|
/* extra top room so the value caption above the highest dot isn't clipped */
|
|
padding-top: 30rpx;
|
|
}
|
|
|
|
.trend-line {
|
|
position: relative;
|
|
width: 100%;
|
|
}
|
|
|
|
.trend-line-img {
|
|
display: block;
|
|
width: 100%;
|
|
}
|
|
|
|
.trend-line-dot {
|
|
position: absolute;
|
|
width: 16rpx;
|
|
height: 16rpx;
|
|
margin-left: -8rpx;
|
|
margin-top: -8rpx;
|
|
border-radius: 50%;
|
|
background: var(--primary);
|
|
border: 3rpx solid var(--card-bg, #FFFFFF);
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.trend-chart.peak .trend-line-dot {
|
|
background: var(--primary);
|
|
}
|
|
|
|
.trend-line-dot.highlight {
|
|
width: 20rpx;
|
|
height: 20rpx;
|
|
margin-left: -10rpx;
|
|
margin-top: -10rpx;
|
|
box-shadow: 0 0 14rpx rgba(var(--primary-rgb), 0.6);
|
|
}
|
|
|
|
/* value caption floats above the dot so it never eats into the line */
|
|
.trend-line-value {
|
|
position: absolute;
|
|
bottom: 100%;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
margin-bottom: 6rpx;
|
|
font-size: 16rpx;
|
|
color: var(--text-secondary);
|
|
line-height: 1;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.trend-line-dot.highlight .trend-line-value {
|
|
color: var(--primary);
|
|
font-weight: 600;
|
|
}
|
|
|
|
.trend-line-labels {
|
|
position: relative;
|
|
height: 28rpx;
|
|
margin-top: 10rpx;
|
|
}
|
|
|
|
.trend-line-label {
|
|
position: absolute;
|
|
transform: translateX(-50%);
|
|
font-size: 20rpx;
|
|
color: var(--text-secondary);
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.trend-line-label.highlight {
|
|
color: var(--primary);
|
|
font-weight: 600;
|
|
}
|