echarts版本升级v4=>v6

main
wangxiaoshuang 2026-04-03 13:45:39 +08:00
parent 3f2e39f46c
commit 48cfe99f12
12 changed files with 255 additions and 100 deletions

View File

@ -37,7 +37,7 @@
"dcmjs": "^0.29.8", "dcmjs": "^0.29.8",
"dicom-parser": "^1.8.9", "dicom-parser": "^1.8.9",
"dicomedit": "^0.1.0", "dicomedit": "^0.1.0",
"echarts": "^4.8.0", "echarts": "^6.0.0",
"element-ui": "^2.15.14", "element-ui": "^2.15.14",
"exceljs": "^4.4.0", "exceljs": "^4.4.0",
"file-saver": "^2.0.5", "file-saver": "^2.0.5",

View File

@ -8,20 +8,49 @@
<script> <script>
import { getReportsChartData } from "@/api/reading" import { getReportsChartData } from "@/api/reading"
let echarts = require('echarts/lib/echarts'); import * as echarts from 'echarts/core';
import { LineChart } from 'echarts/charts';
import {
TitleComponent,
TooltipComponent,
GridComponent,
DataZoomComponent,
LegendComponent,
DatasetComponent,
// (filter, sort)
TransformComponent
} from 'echarts/components';
//
import { LabelLayout, UniversalTransition } from 'echarts/features';
// Canvas CanvasRenderer SVGRenderer
import { CanvasRenderer } from 'echarts/renderers';
echarts.use([
TitleComponent,
TooltipComponent,
GridComponent,
DatasetComponent,
TransformComponent,
DataZoomComponent,
LegendComponent,
LineChart,
LabelLayout,
UniversalTransition,
CanvasRenderer
]);
// let echarts = require('echarts/lib/echarts');
// //
// require('echarts/lib/chart/bar'); // require('echarts/lib/chart/bar');
require('echarts/lib/chart/line'); // require('echarts/lib/chart/line');
// require('echarts/lib/chart/pie'); // require('echarts/lib/chart/pie');
// require('echarts/lib/chart/scatter'); // require('echarts/lib/chart/scatter');
// //
require('echarts/lib/component/tooltip'); // require('echarts/lib/component/tooltip');
require('echarts/lib/component/title'); // require('echarts/lib/component/title');
require('echarts/lib/component/legend'); // require('echarts/lib/component/legend');
require('echarts/lib/component/grid'); // require('echarts/lib/component/grid');
require('echarts/lib/component/dataZoom'); // require('echarts/lib/component/dataZoom');
export default { export default {
name: "readingChart", name: "readingChart",
props: { props: {
@ -151,7 +180,13 @@ export default {
text: obj.title, text: obj.title,
textStyle: { textStyle: {
color: "#fff" color: "#fff"
} },
left: 0,
top: 0
},
grid: {
left: 50,
bottom: 30
}, },
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
@ -193,6 +228,7 @@ export default {
} }
}, },
axisLine: { axisLine: {
show: true,
lineStyle: { lineStyle: {
color: '#fff', color: '#fff',
} }

View File

@ -2,8 +2,8 @@
<div ref="mapbox" class="map-wrapper" /> <div ref="mapbox" class="map-wrapper" />
</template> </template>
<script> <script>
import echarts from 'echarts' import * as echarts from 'echarts'
import 'modules/echarts/map/js/world.js' // import 'modules/echarts/map/js/world.js'
import { fontSize } from 'utils/fontsize' import { fontSize } from 'utils/fontsize'
export default { export default {
props: { props: {
@ -14,7 +14,7 @@ export default {
watch: { watch: {
area() { area() {
const that = this const that = this
this.$nextTick(function() { this.$nextTick(function () {
that.myChart.resize() that.myChart.resize()
}) })
} }
@ -56,7 +56,7 @@ export default {
} }
] ]
] ]
var convertData = function(data) { var convertData = function (data) {
var res = [] var res = []
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
var dataItem = data[i] var dataItem = data[i]
@ -77,67 +77,67 @@ export default {
return res return res
} }
var series = [] var series = []
;[['Shanghai', BJData]].forEach(function(item, i) { ;[['Shanghai', BJData]].forEach(function (item, i) {
series.push( series.push(
{ {
type: 'lines', type: 'lines',
zlevel: 1, zlevel: 1,
effect: { effect: {
show: true,
color: '#fff',
period: 6,
trailLength: 0.7,
symbolSize: fontSize(0.05)
},
lineStyle: {
normal: {
width: fontSize(0.03),
color: '#9ae5fc',
opacity: 0.02,
curveness: -0.2
}
},
data: convertData(item[1])
},
{
type: 'effectScatter',
coordinateSystem: 'geo',
zlevel: 3,
rippleEffect: {
//
period: 5, //
brushType: 'fill', // stroke, fill
scale: 5 //
},
label: {
normal: {
show: true, show: true,
color: '#fce630', color: '#fff',
position: 'right', // period: 6,
offset: [10, 0], // trailLength: 0.7,
fontSize: fontSize(0.16), symbolSize: fontSize(0.05)
formatter: '{b}' //
}, },
emphasis: { lineStyle: {
show: true normal: {
} width: fontSize(0.03),
}, color: '#9ae5fc',
symbol: 'circle', opacity: 0.02,
symbolSize: function(val) { curveness: -0.2
return fontSize(0.08) // }
},
data: convertData(item[1])
}, },
data: item[1].map(function(dataItem) { {
return { type: 'effectScatter',
name: dataItem[0].name, coordinateSystem: 'geo',
value: geoCoordMap[dataItem[0].name] zlevel: 3,
} rippleEffect: {
}) //
} period: 5, //
) brushType: 'fill', // stroke, fill
}) scale: 5 //
},
label: {
normal: {
show: true,
color: '#fce630',
position: 'right', //
offset: [10, 0], //
fontSize: fontSize(0.16),
formatter: '{b}' //
},
emphasis: {
show: true
}
},
symbol: 'circle',
symbolSize: function (val) {
return fontSize(0.08) //
},
data: item[1].map(function (dataItem) {
return {
name: dataItem[0].name,
value: geoCoordMap[dataItem[0].name]
}
})
}
)
})
var option = { var option = {
// backgroundColor: '#fff', // backgroundColor: '#fff',
title: { title: {
@ -161,7 +161,7 @@ export default {
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
fontSize: fontSize(0.16), fontSize: fontSize(0.16),
formatter: function(params) { formatter: function (params) {
if (typeof params.value === 'undefined') { if (typeof params.value === 'undefined') {
return '' return ''
} else { } else {

View File

@ -2,7 +2,7 @@
<div ref="trials_stats" style="width:100%;height:100%;" /> <div ref="trials_stats" style="width:100%;height:100%;" />
</template> </template>
<script> <script>
import echarts from 'echarts' import * as echarts from 'echarts'
import { getTrialCountRank } from '@/api/dashboard' import { getTrialCountRank } from '@/api/dashboard'
import { fontSize } from 'utils/fontsize' import { fontSize } from 'utils/fontsize'
const Count = 5 const Count = 5

View File

@ -2,7 +2,7 @@
<div ref="enroll_stats" style="width:100%;height:100%;" /> <div ref="enroll_stats" style="width:100%;height:100%;" />
</template> </template>
<script> <script>
import echarts from 'echarts' import * as echarts from 'echarts'
import { getEnrollDataByQuarter } from '@/api/dashboard' import { getEnrollDataByQuarter } from '@/api/dashboard'
import { fontSize } from 'utils/fontsize' import { fontSize } from 'utils/fontsize'
const Count = 6 const Count = 6

View File

@ -2,7 +2,7 @@
<div ref="reviewers_stats" style="width:100%;height:100%;padding:5px;" /> <div ref="reviewers_stats" style="width:100%;height:100%;padding:5px;" />
</template> </template>
<script> <script>
import echarts from 'echarts' import * as echarts from 'echarts'
import { getReviewersByRank } from '@/api/dashboard' import { getReviewersByRank } from '@/api/dashboard'
import { fontSize } from 'utils/fontsize' import { fontSize } from 'utils/fontsize'
export default { export default {

View File

@ -2,7 +2,7 @@
<div ref="monthly_reading_stats" style="width:100%;height:100%;" /> <div ref="monthly_reading_stats" style="width:100%;height:100%;" />
</template> </template>
<script> <script>
import echarts from 'echarts' import * as echarts from 'echarts'
import { getReadingDataByMonth } from '@/api/dashboard' import { getReadingDataByMonth } from '@/api/dashboard'
import { fontSize } from 'utils/fontsize' import { fontSize } from 'utils/fontsize'
const Count = 6 const Count = 6

View File

@ -2,7 +2,7 @@
<div ref="reading_rank" class="reading-rank" /> <div ref="reading_rank" class="reading-rank" />
</template> </template>
<script> <script>
import echarts from 'echarts' import * as echarts from 'echarts'
import { getReadingDataRank } from '@/api/dashboard' import { getReadingDataRank } from '@/api/dashboard'
import { fontSize } from 'utils/fontsize' import { fontSize } from 'utils/fontsize'
const Count = 5 const Count = 5

View File

@ -2,7 +2,7 @@
<div ref="reading_stats" style="width:100%;height:100%;padding-top:5px;" /> <div ref="reading_stats" style="width:100%;height:100%;padding-top:5px;" />
</template> </template>
<script> <script>
import echarts from 'echarts' import * as echarts from 'echarts'
import { getReadingDataByType } from '@/api/dashboard' import { getReadingDataByType } from '@/api/dashboard'
import { fontSize } from 'utils/fontsize' import { fontSize } from 'utils/fontsize'
export default { export default {

View File

@ -165,6 +165,11 @@
v-if="(criterionType === 0 && readingTool === 0) || this.readingTool === 3"> v-if="(criterionType === 0 && readingTool === 0) || this.readingTool === 3">
<svg-icon icon-class="mpr" class="svg-icon" style="transform: rotate(180deg);" /> <svg-icon icon-class="mpr" class="svg-icon" style="transform: rotate(180deg);" />
</div> </div>
<!-- 直方图 -->
<div class="tool-item" :title="`${$t('trials:reading:button:histogram')}`" @click.prevent="openHistogram"
v-if="this.readingTool === 3">
<svg-icon icon-class="histogram" class="svg-icon" />
</div>
<!-- 十字准星 --> <!-- 十字准星 -->
<div :class="['tool-item', activeTool === 'Crosshairs' ? 'tool-item-active' : '']" v-if="isMPR" <div :class="['tool-item', activeTool === 'Crosshairs' ? 'tool-item-active' : '']" v-if="isMPR"
:title="$t('trials:reading:button:crosshairs')" @click.prevent="setToolActive('Crosshairs')"> :title="$t('trials:reading:button:crosshairs')" @click.prevent="setToolActive('Crosshairs')">
@ -495,6 +500,7 @@
:subject-code="uploadSubjectCode" :criterion="uploadTrialCriterion" :task-id="taskId" :subject-code="uploadSubjectCode" :criterion="uploadTrialCriterion" :task-id="taskId"
:visible.sync="downloadImageVisible" /> :visible.sync="downloadImageVisible" />
<readingChart ref="readingChart" /> <readingChart ref="readingChart" />
<histogram ref="histogram" />
</div> </div>
</template> </template>
<script> <script>
@ -526,6 +532,7 @@ import PetCtViewport from './PetCtViewport'
import MPRViewport from './MPRViewport' import MPRViewport from './MPRViewport'
import VolumeViewport from './VolumeViewport' import VolumeViewport from './VolumeViewport'
import Segmentations from './Segmentations' import Segmentations from './Segmentations'
import histogram from "./histogram"
import mRecisit from './mRecist/QuestionList' import mRecisit from './mRecist/QuestionList'
import recisit from './Recist/QuestionList' import recisit from './Recist/QuestionList'
import customizeQuestionList from './customize/QuestionList' import customizeQuestionList from './customize/QuestionList'
@ -617,6 +624,7 @@ export default {
MPRViewport, MPRViewport,
VolumeViewport, VolumeViewport,
Segmentations, Segmentations,
histogram,
mRecisit, mRecisit,
recisit, recisit,
customizeQuestionList, customizeQuestionList,
@ -906,6 +914,10 @@ export default {
this.getSystemInfoReading(); this.getSystemInfoReading();
}, },
methods: { methods: {
async openHistogram() {
let res = await this.$refs.histogram.getCurrentSliceValuesFromVoxelManager(renderingEngineId, `${this.viewportKey}-${this.activeViewportIndex}`)
console.log(res, 'openHistogram')
},
handleSizeChange(e, viewportId) { handleSizeChange(e, viewportId) {
// console.log('handleSizeChange', e) // console.log('handleSizeChange', e)
this.resetRenderingEngine(viewportId) this.resetRenderingEngine(viewportId)

View File

@ -46,20 +46,49 @@ import {
getTrialCriterionList, getTrialCriterionList,
getReportsChartSummary getReportsChartSummary
} from '@/api/trials' } from '@/api/trials'
let echarts = require('echarts/lib/echarts'); import * as echarts from 'echarts/core';
import { LineChart } from 'echarts/charts';
import {
TitleComponent,
TooltipComponent,
GridComponent,
DataZoomComponent,
LegendComponent,
DatasetComponent,
// (filter, sort)
TransformComponent
} from 'echarts/components';
//
import { LabelLayout, UniversalTransition } from 'echarts/features';
// Canvas CanvasRenderer SVGRenderer
import { CanvasRenderer } from 'echarts/renderers';
echarts.use([
TitleComponent,
TooltipComponent,
GridComponent,
DatasetComponent,
TransformComponent,
DataZoomComponent,
LegendComponent,
LineChart,
LabelLayout,
UniversalTransition,
CanvasRenderer
]);
// let echarts = require('echarts/lib/echarts');
// //
// require('echarts/lib/chart/bar'); // require('echarts/lib/chart/bar');
require('echarts/lib/chart/line'); // require('echarts/lib/chart/line');
// require('echarts/lib/chart/pie'); // require('echarts/lib/chart/pie');
// require('echarts/lib/chart/scatter'); // require('echarts/lib/chart/scatter');
// //
require('echarts/lib/component/tooltip'); // require('echarts/lib/component/tooltip');
require('echarts/lib/component/title'); // require('echarts/lib/component/title');
require('echarts/lib/component/legend'); // require('echarts/lib/component/legend');
require('echarts/lib/component/grid'); // require('echarts/lib/component/grid');
require('echarts/lib/component/dataZoom'); // require('echarts/lib/component/dataZoom');
export default { export default {
name: "SubjectChart", name: "SubjectChart",
props: { props: {
@ -259,12 +288,19 @@ export default {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
}, },
grid: {
left: 30,
bottom: 30
},
xAxis: { xAxis: {
data: obj.visitName, data: obj.visitName,
}, },
yAxis: { yAxis: {
name: obj.unit, name: obj.unit,
type: 'value', type: 'value',
axisLine: {
show: true
}
}, },
series: obj.series series: obj.series
}; };

View File

@ -36,17 +36,49 @@
</template> </template>
<script> <script>
import BaseContainer from '@/components/BaseContainer' import BaseContainer from '@/components/BaseContainer'
let echarts = require('echarts/lib/echarts'); import * as echarts from 'echarts/core';
import { BarChart, FunnelChart } from 'echarts/charts';
import {
TitleComponent,
TooltipComponent,
GridComponent,
DataZoomComponent,
LegendComponent,
MarkLineComponent,
DatasetComponent,
// (filter, sort)
TransformComponent
} from 'echarts/components';
//
import { LabelLayout, UniversalTransition } from 'echarts/features';
// Canvas CanvasRenderer SVGRenderer
import { CanvasRenderer } from 'echarts/renderers';
echarts.use([
TitleComponent,
TooltipComponent,
GridComponent,
DatasetComponent,
TransformComponent,
DataZoomComponent,
MarkLineComponent,
LegendComponent,
BarChart,
FunnelChart,
LabelLayout,
UniversalTransition,
CanvasRenderer
]);
// let echarts = require('echarts/lib/echarts');
require('echarts/lib/component/markLine'); // require('echarts/lib/component/markLine');
require('echarts/lib/chart/funnel'); // require('echarts/lib/chart/funnel');
require('echarts/lib/chart/bar'); // require('echarts/lib/chart/bar');
// //
require('echarts/lib/component/tooltip'); // require('echarts/lib/component/tooltip');
require('echarts/lib/component/title'); // require('echarts/lib/component/title');
require('echarts/lib/component/legend'); // require('echarts/lib/component/legend');
require('echarts/lib/component/grid'); // require('echarts/lib/component/grid');
require('echarts/lib/component/dataZoom'); // require('echarts/lib/component/dataZoom');
import { import {
getTrialCriterionList, getTrialCriterionList,
getTrialVisitFinishedStatList, getTrialVisitFinishedStatList,
@ -178,8 +210,11 @@ export default {
this.chart_left = echarts.init(this.$refs.chartContainer_left); this.chart_left = echarts.init(this.$refs.chartContainer_left);
// ... // ...
const option = { const option = {
richInheritPlainLabel: false,
title: { title: {
text: obj.titleText text: obj.titleText,
left: 0,
top: 0
}, },
color: this.color, color: this.color,
tooltip: { tooltip: {
@ -316,7 +351,13 @@ export default {
// ... // ...
const option = { const option = {
title: { title: {
text: obj.titleText text: obj.titleText,
left: 0,
top: 0
},
grid: {
left: 80,
bottom: 50
}, },
toolbox: { toolbox: {
show: false show: false
@ -339,6 +380,9 @@ export default {
], ],
yAxis: [ yAxis: [
{ {
axisLine: {
show: true
},
name: obj.unit, name: obj.unit,
type: 'value' type: 'value'
} }
@ -424,12 +468,18 @@ export default {
// ... // ...
const option = { const option = {
title: { title: {
text: obj.titleText text: obj.titleText,
left: 0,
top: 0
}, },
toolbox: { toolbox: {
show: false show: false
}, },
color: this.color, color: this.color,
grid: {
left: 80,
bottom: 50
},
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
@ -441,6 +491,9 @@ export default {
data: obj.xAxisData data: obj.xAxisData
}, },
yAxis: { yAxis: {
axisLine: {
show: true
},
name: obj.unit, name: obj.unit,
type: 'value', type: 'value',
minInterval: 1 minInterval: 1
@ -474,11 +527,17 @@ export default {
// ... // ...
const option = { const option = {
title: { title: {
text: obj.titleText text: obj.titleText,
left: 0,
top: 0
}, },
toolbox: { toolbox: {
show: false show: false
}, },
grid: {
left: 80,
bottom: 50
},
color: this.color, color: this.color,
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
@ -498,8 +557,11 @@ export default {
yAxis: { yAxis: {
name: obj.unit, name: obj.unit,
type: 'value', type: 'value',
axisLine: {
show: true
},
axisLabel: { axisLabel: {
formatter: '{value}%' formatter: '{value}%',
} }
}, },
series: { series: {
@ -531,7 +593,13 @@ export default {
// ... // ...
const option = { const option = {
title: { title: {
text: obj.titleText text: obj.titleText,
left: 0,
top: 0
},
grid: {
left: 80,
bottom: 50
}, },
toolbox: { toolbox: {
show: false show: false
@ -550,7 +618,10 @@ export default {
}, },
yAxis: { yAxis: {
name: obj.unit, name: obj.unit,
type: 'value' type: 'value',
axisLine: {
show: true
}
}, },
series: { series: {
markLine: { markLine: {