feat: chart 添加topo图类(50%)

This commit is contained in:
zhangyu
2021-06-29 16:12:56 +08:00
parent f6901f98d6
commit 1d59f77117
4 changed files with 18 additions and 12 deletions

View File

@@ -236,7 +236,11 @@ export default {
chartTitleShow: {
type: Boolean,
default: true
}
},
fromTopo: {
type: Boolean,
default: false
},
},
computed: {
getButtonCode () {
@@ -937,6 +941,9 @@ export default {
if (unit.type == 'Time') {
delete option.yAxis.maxInterval
}
if (this.fromTopo) {
option.minInterval = 20 * 60 * 1000
}
// params.series = dataArg;
if (chartSite === 'local') { // 本地显示
if (legend) {
@@ -962,7 +969,7 @@ export default {
setTimeout(function () {
const divHeight = self.$refs.legendArea.offsetHeight
if (!chartInfo.height) {
getChart(self.chartIndex).resize({ height: (400 - divHeight - chartResizeTool.titleHeight - chartResizeTool.chartBlankHeight) })
getChart(self.chartIndex).resize({ height: (250 - divHeight - chartResizeTool.titleHeight - chartResizeTool.chartBlankHeight) })
} else {
getChart(self.chartIndex).resize({ height: (chartInfo.height * vm.stepWidth - divHeight - chartResizeTool.titleHeight - chartResizeTool.chartBlankHeight) })
}

View File

@@ -438,7 +438,7 @@ export default {
top: 0,
left: 0,
show: false,
height: 400
height: 250
},
chartData: {},
chartGetData: [],
@@ -523,7 +523,6 @@ export default {
immediate: true,
deep: true,
handler (n) {
console.log(n)
setTimeout(() => {
this.init()
}, 100)
@@ -589,7 +588,7 @@ export default {
})
}
query += '&nullType=' + 'connected'
return this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)
return this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + '10m')
})
axiosArr.push({ item, arr })
promiseArr.push(pensPromise(item, arr, index))
@@ -1643,7 +1642,6 @@ export default {
editTopology (val) {
this.editTopologyFlag = true
setTimeout(() => {
console.log(getTopology(this.topologyIndex))
getTopology(this.topologyIndex).lock(0)
getTopology(this.topologyIndex).data.pens.forEach((item, index) => { // 停止动画 以及赋值默认data
if (item.animatePlay) {

View File

@@ -10,6 +10,7 @@
:panel-id="-1"
:is-lock="true"
:chart-index="0"
:fromTopo="true"
:chartTitleShow="false"
:chart-data="chartData">
</line-chart-block>
@@ -61,8 +62,8 @@ export default {
},
data () {
return {
tempDom: { height: 400, width: '' },
chartDataTemp: { id: 8832, prev: null, next: null, panelId: 0, title: '123', span: 12, height: 12, createAt: '2021-01-27 07:36:19', unit: 2, weight: 0, pid: null, buildIn: null, seq: null, param: { last: 0, legendValue: { total: 'off', min: 'off', avg: 'off', last: 'off', max: 'off' }, threshold: '', url: '', nullType: 'connected' }, sync: null, asset: null, isLoaded: true, from: '__vue_devtool_undefined__', draggable: true, resizable: true, editable: true },
tempDom: { height: 250, width: '' },
chartDataTemp: { id: 8832, prev: null, next: null, panelId: 0, title: '123', span: 12, height: 0, createAt: '2021-01-27 07:36:19', unit: 2, weight: 0, pid: null, buildIn: null, seq: null, param: { last: 0, legendValue: { total: 'off', min: 'off', avg: 'off', last: 'off', max: 'off' }, threshold: '', url: '', nullType: 'connected' }, sync: null, asset: null, isLoaded: true, from: '__vue_devtool_undefined__', draggable: true, resizable: true, editable: true },
chartData: {},
filter: {
end_time: bus.timeFormate(bus.getOffsetTimezoneData(), 'yyyy-MM-dd hh:mm:ss'),
@@ -77,7 +78,7 @@ export default {
},
methods: {
tempDomInit () {
this.tempDom.width = 400
this.tempDom.width = 250
},
process (item) {
const chartData = { ...this.chartDataTemp, ...item }
@@ -332,13 +333,13 @@ export default {
max-height: 400px;
min-height: 200px;
height: 100%;
box-sizing: border-box;
.tooltip-box-chart{
border: 1px solid #E7EAED;
width: 400px;
width: 300px;
max-height: 400px;
min-height: 200px;
height: 100%;
margin-right: 10px;
}
.tooltip-box-info{
border: 1px solid #E7EAED;

View File

@@ -468,7 +468,7 @@ export default {
top: 0,
left: 0,
show: false,
height: 400
height: 250
},
chartData: {},
chartGetData: [],