From f691523b64f09f80aa40d551ddb7a038c992c3f2 Mon Sep 17 00:00:00 2001 From: quietcoder <1642965215@qq.com> Date: Sat, 2 Dec 2017 15:51:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=BD=B4=E6=8A=98=E7=BA=BF=E5=9B=BE=20tooltip=20=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/line.js | 17 +++++++++++++++++ src/packages/line/main.js | 4 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/examples/data/line.js b/examples/data/line.js index 9378327..daf0117 100644 --- a/examples/data/line.js +++ b/examples/data/line.js @@ -17,6 +17,23 @@ export default { }, settings: {} }, + { + name: '时间轴折线图', + data: { + columns: ['日期', '余额', '年龄'], + rows: [ + { '日期': new Date(1512097200000), '余额': 123, '年龄': 3 }, + { '日期': new Date(1512097220000), '余额': 1223, '年龄': 6 }, + { '日期': new Date(1512097230000), '余额': 2123, '年龄': 9 }, + { '日期': new Date(1512097240000), '余额': 4123, '年龄': 12 }, + { '日期': new Date(1512097260000), '余额': 3123, '年龄': 15 }, + { '日期': new Date(1512097280000), '余额': 7123, '年龄': 20 } + ] + }, + settings: { + xAxisType: 'time' + } + }, { name: 'label 属性配置', data: { diff --git a/src/packages/line/main.js b/src/packages/line/main.js index d374582..8cbb8ef 100755 --- a/src/packages/line/main.js +++ b/src/packages/line/main.js @@ -124,7 +124,9 @@ function getLineTooltip (args) { trigger: 'axis', formatter (items) { let tpl = [] - tpl.push(`${items[0].name}
`) + const { name, axisValueLabel } = items[0] + const title = name || axisValueLabel + tpl.push(`${title}
`) items.forEach(item => { let showData = null const type = ~rightList.indexOf(item.seriesName)