Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b9bf1223
authored
Apr 08, 2026
by
zhangxw
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix(venus-usedcar-quality): 车况简报折线图修改
1 parent
d919b1e0
Pipeline
#193
for
b9bf1223
failed
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
12 deletions
apps/web/venus-usedcar-quality/src/views/report/vehicle-brief/index.vue
apps/web/venus-usedcar-quality/src/views/report/vehicle-brief/index.vue
View file @
b9bf122
...
...
@@ -339,8 +339,12 @@ const handleTrendResize = () => {
function setData(data: any) {
const trends = (data as any)?.priceTrends || [];
const xAxisData = Array.isArray(trends) ? trends.map((i: any) => String(i?.month ?? "")) : [];
const seriesData = Array.isArray(trends) ? trends.map((i: any) => Number(i?.priceWan ?? 0)) : [];
const xAxisData = Array.isArray(trends)
? trends.map((i: any) => String(i?.month ?? ""))
: [];
const seriesData = Array.isArray(trends)
? trends.map((i: any) => Number(i?.priceWan ?? i?.price ?? i?.value ?? 0))
: [];
const numeric = seriesData.filter((n) => Number.isFinite(n));
hasTrendData.value = numeric.length > 0;
if (!hasTrendData.value) {
...
...
@@ -351,8 +355,9 @@ function setData(data: any) {
}
const minVal = numeric.length > 0 ? Math.min(...numeric) : 0;
const maxVal = numeric.length > 0 ? Math.max(...numeric) : 0;
const yMin = numeric.length > 0 ? Math.max(0, Math.floor((minVal - 0.5) * 10) / 10) : 0;
const yMax = numeric.length > 0 ? Math.ceil((maxVal + 0.5) * 10) / 10 : 1;
const yMin = numeric.length > 0 ? Math.max(0, Math.floor(minVal)) : 0;
let yMax = numeric.length > 0 ? Math.ceil(maxVal) : 1;
if (yMax <= yMin) yMax = yMin + 1;
trendChart?.dispose();
trendChart = echarts.init(trendChartRef.value, undefined, { renderer: "canvas" });
...
...
@@ -363,18 +368,24 @@ function setData(data: any) {
return s;
};
const format
Wan
Text = (raw: unknown) => {
const format
Value
Text = (raw: unknown) => {
const n = Number(raw);
if (!Number.isFinite(n)) return "-";
const fixed = n.toFixed(1);
return fixed.endsWith(".0") ? fixed.slice(0, -2) : fixed;
const fixed = n.toFixed(2);
if (fixed.endsWith(".00")) return fixed.slice(0, -3);
if (fixed.endsWith("0")) return fixed.slice(0, -1);
return fixed;
};
const gridLeft = 8;
trendChart.setOption({
grid: { left:
44
, right: 12, top: 12, bottom: 24, containLabel: true },
grid: { left:
gridLeft
, right: 12, top: 12, bottom: 24, containLabel: true },
tooltip: {
trigger: "axis",
triggerOn: "click",
confine: true,
alwaysShowContent: true,
backgroundColor: "#ffffff",
borderColor: "transparent",
extraCssText: "box-shadow: 0 6px 18px rgba(0,0,0,0.12); border-radius: 8px; padding: 10px 12px;",
...
...
@@ -383,13 +394,26 @@ function setData(data: any) {
type: "line",
lineStyle: { color: "rgba(0,0,0,0.18)", width: 1 },
},
position: (point: any, _params: any, _dom: any, _rect: any, size: any) => {
const [x, y] = point as [number, number];
const [contentWidth, contentHeight] = size.contentSize as [number, number];
const [viewWidth, viewHeight] = size.viewSize as [number, number];
const left = Math.min(Math.max(0, x - contentWidth / 2), viewWidth - contentWidth);
const top = Math.min(Math.max(0, y - contentHeight - 12), viewHeight - contentHeight);
return [left, top];
},
formatter: (params: any) => {
const first = Array.isArray(params) ? params[0] : params;
const month = formatMonthLabel(first?.axisValue ?? "");
const value = formatWanText(first?.data);
const idx = Number(first?.dataIndex);
const yearMonth =
Number.isFinite(idx) && trends[idx]
? String((trends[idx] as any)?.yearMonth ?? (trends[idx] as any)?.year_month ?? "")
: "";
const month = yearMonth || formatMonthLabel(first?.axisValue ?? "");
const value = formatValueText(first?.data);
return `
<
div
style
=
"line-height: 18px;"
>
<
div
style
=
"font-weight: 600; margin-bottom: 2px;"
>
$
{
month
}
<
/div
>
<
div
>
本车预估价值:
$
{
value
}
万
<
/div
>
<
div
>
本车预估价值:
$
{
value
}
<
/div
>
<
/div>`
;
},
},
...
...
@@ -411,7 +435,11 @@ function setData(data: any) {
fontSize
:
10
,
margin
:
10
,
align
:
"right"
,
formatter
:
(
v
:
unknown
)
=>
formatWanText
(
v
),
formatter
:
(
v
:
unknown
)
=>
{
const
n
=
Number
(
v
);
if
(
!
Number
.
isFinite
(
n
))
return
"-"
;
return
String
(
Math
.
round
(
n
));
},
},
splitLine
:
{
lineStyle
:
{
color
:
"#f0f0f0"
}
}
},
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment