refactor: 默认使用svg渲染echart

This commit is contained in:
Captain.B 2020-08-26 16:23:31 +08:00
parent e483748b97
commit b653848594
8 changed files with 452 additions and 397 deletions

View File

@ -9,7 +9,7 @@
</div>
</el-row>
<chart id="chart" ref="chart" :options="options" :autoresize="true"></chart>
<ms-chart id="chart" ref="chart" :options="options" :autoresize="true"></ms-chart>
<el-row type="flex" justify="center" align="middle">
<i class="circle success"/>
<div class="metric-box">
@ -50,9 +50,11 @@
</template>
<script>
import MsChart from "@/business/components/common/chart/MsChart";
export default {
name: "MsMetricChart",
components: {MsChart},
props: {
content: Object,
totalTime: Number
@ -62,7 +64,7 @@
hour: 0,
minutes: 0,
seconds: 0,
time: 0
time: 0,
}
},
created() {

View File

@ -0,0 +1,41 @@
<template>
<chart
:init-options="defaultInitOptions"
:options="options"
:theme="theme"
:group="group"
:watch-shallow="watchShallow"
:manual-update="manualUpdate"
:autoresize="autoresize"/>
</template>
<script>
export default {
name: "MsChart",
props: {
options: Object,
theme: [String, Object],
initOptions: Object,
group: String,
autoresize: Boolean,
watchShallow: Boolean,
manualUpdate: Boolean
},
data() {
return {
defaultInitOptions: this.initOptions
}
},
mounted() {
this.defaultInitOptions = this.defaultInitOptions || {};
// svg
if (!this.defaultInitOptions.renderer) {
this.defaultInitOptions.renderer = 'svg';
}
}
}
</script>
<style scoped>
</style>

View File

@ -1,17 +1,19 @@
<template>
<div>
<chart :options="options">
</chart>
<ms-chart :options="options">
</ms-chart>
</div>
</template>
<script>
import MsChart from "@/business/components/common/chart/MsChart";
export default {
name: "MsPieChart",
components: {},
components: {MsChart},
mounted() {
this.getDataNamesByData();
},

View File

@ -1,12 +1,14 @@
<template>
<chart :options="bar"></chart>
<ms-chart :options="bar"></ms-chart>
</template>
<script>
import echarts from 'echarts'
import MsChart from "@/business/components/common/chart/MsChart";
export default {
name: "PerformanceChart",
components: {MsChart},
data() {
return {
bar: {

View File

@ -84,7 +84,7 @@
</el-col>
<el-col :span="14">
<div class="title">{{ $t('load_test.pressure_prediction_chart') }}</div>
<chart class="chart-container" ref="chart1" :options="orgOptions" :autoresize="true"></chart>
<ms-chart class="chart-container" ref="chart1" :options="orgOptions" :autoresize="true"></ms-chart>
</el-col>
</el-row>
</div>
@ -92,6 +92,7 @@
<script>
import echarts from "echarts";
import MsChart from "@/business/components/common/chart/MsChart";
const TARGET_LEVEL = "TargetLevel";
const RAMP_UP = "RampUp";
@ -102,6 +103,7 @@ const RPS_LIMIT_ENABLE = "rpsLimitEnable";
export default {
name: "MsPerformancePressureConfig",
components: {MsChart},
props: ['report'],
data() {
return {

View File

@ -59,18 +59,21 @@
<el-row>
<el-col :span="12">
<chart ref="chart1" :options="loadOption" class="chart-config" :autoresize="true"></chart>
<ms-chart ref="chart1" :options="loadOption" class="chart-config" :autoresize="true"></ms-chart>
</el-col>
<el-col :span="12">
<chart ref="chart2" :options="resOption" class="chart-config" :autoresize="true"></chart>
<ms-chart ref="chart2" :options="resOption" class="chart-config" :autoresize="true"></ms-chart>
</el-col>
</el-row>
</div>
</template>
<script>
import MsChart from "@/business/components/common/chart/MsChart";
export default {
name: "TestOverview",
components: {MsChart},
data() {
return {
maxUsers: "0",

View File

@ -99,7 +99,7 @@
</el-col>
<el-col :span="14">
<div class="title">{{ $t('load_test.pressure_prediction_chart') }}</div>
<chart class="chart-container" ref="chart1" :options="orgOptions" :autoresize="true"></chart>
<ms-chart class="chart-container" ref="chart1" :options="orgOptions" :autoresize="true"></ms-chart>
</el-col>
</el-row>
</div>
@ -107,6 +107,7 @@
<script>
import echarts from "echarts";
import MsChart from "@/business/components/common/chart/MsChart";
const TARGET_LEVEL = "TargetLevel";
const RAMP_UP = "RampUp";
@ -117,6 +118,7 @@ const RPS_LIMIT_ENABLE = "rpsLimitEnable";
export default {
name: "PerformancePressureConfig",
components: {MsChart},
props: {
testPlan: {
type: Object

View File

@ -2,6 +2,7 @@ import ECharts from 'vue-echarts'
import 'echarts/lib/chart/line'
import 'echarts/lib/chart/bar'
import 'echarts/lib/chart/pie'
import 'zrender/lib/svg/svg'
export default {
install(Vue) {