diff --git a/src/components/charts/chart-options.js b/src/components/charts/chart-options.js
index 32ffc4e1..dd988736 100644
--- a/src/components/charts/chart-options.js
+++ b/src/components/charts/chart-options.js
@@ -230,11 +230,69 @@ const pieWithTable = {
}
]
}
+const routinestraightline = {
+ tooltip: {
+ show: false
+ },
+ xAxis: {
+ type: 'time',
+ show: false
+ },
+ yAxis: {
+ type: 'value',
+ show: false
+ },
+ animation: false,
+ grid: {
+ left: 0,
+ bottom: 0,
+ top: 0,
+ right: 0
+ },
+ color: chartColor,
+ legend: {
+ tooltip: {
+ show: true,
+ formatter: '{a}'
+ },
+ show: false,
+ right: 23,
+ top: 8,
+ orient: 'horizontal',
+ icon: 'circle',
+ itemGap: 20,
+ itemWidth: 10,
+ textStyle: {
+ padding: [0, 0, 0, 5],
+ fontSize: 14
+ },
+ formatter: tooLongFormatter
+ },
+ series: [
+ {
+ name: '访问用户量',
+ type: 'line',
+ smooth: true,
+ itemStyle: {
+ normal: {
+ color: '#81C9FF',
+ lineStyle: {
+ width:2
+ }
+ }
+ },
+ data: [],
+ showSymbol: false,
+ areaStyle: { color: '#C9EAFF' }
+ }
+ ]
+}
const typeOptionMappings = [
{ value: 11, option: line }, // 常规折线图
{ value: 12, option: lineWithStatistics }, // 带统计表格的折线图
{ value: 13, option: lineStack }, // 折线堆叠图
- { value: 31, option: pieWithTable } // 常规折线图
+ { value: 31, option: pieWithTable }, // 常规折线图
+ { value: 52, option: routinestraightline }
]
const typeCategory = {
MAP: 'map',
diff --git a/src/views/charts/Chart.vue b/src/views/charts/Chart.vue
index 9503a101..7562c0a4 100644
--- a/src/views/charts/Chart.vue
+++ b/src/views/charts/Chart.vue
@@ -82,12 +82,24 @@
:type="chartInfo.type"
:style="computePosition"
:icon="singleValue.icon"
+ :father="father"
>
+
{{item.result}}
{{chartInfo.i18n ? $t(chartInfo.i18n) : chartInfo.name}}
{{handleSingleValue[0]}}
{{handleSingleValue[1]}}
+
+
+
{
if (response.code === 200) {
this.singleValue.value = response.data.result
+ this.father = response.data.result
}
})
if (this.isSingleValueWithEcharts) { // 带曲线的单值图
+ const dom = document.getElementById(`chart${this.chartInfo.id}`)
+ !this.myChart && (this.myChart = echarts.init(dom))
+ this.chartOption = this.$_.cloneDeep(getOption(this.chart.type))
+ const seriesTemplate = this.chartOption.series[0]
+
+ const queryParams = { startTime: parseInt(this.timeFilter.startTime / 1000), endTime: parseInt(this.timeFilter.endTime / 1000) }
get(replaceUrlPlaceholder(chartParams.urlLine, queryParams)).then(response => {
if (response.code === 200) {
+ response.data.result = [
+ {
+ legend: "session_rate",
+ values:[
+ ["1625122200","2"],["1625122500","2"],["1625122800","1"],["1625123100","1"],["1625123400","2"],["1625123700","2"],["1625124000","2"],["1625124300","3"],["1625124600","3"],["1625124900","3"]
+ ]
+ }
+ ]
+
+ this.chartOption.series = response.data.result.map((r, i) => {
+ return {
+ ...seriesTemplate,
+ name: r.legend,
+ data: r.values.map(v => [Number(v[0]) * 1000, Number(v[1]), chartParams.unitType]),
+ lineStyle: {
+ color: getChartColor[i]
+ }
+ }
+ })
}
+ this.myChart.setOption(this.chartOption)
+ this.$nextTick(() => {
+ this.myChart.resize()
+ })
})
}
}