From 577564cf7e7c931305688061847264ae882f64fc Mon Sep 17 00:00:00 2001 From: nikogu <644506165@qq.com> Date: Tue, 24 Oct 2017 18:00:00 +0800 Subject: [PATCH] fixed charts padding --- src/components/Charts/MiniArea/index.js | 18 ++++++------------ src/components/Charts/MiniBar/index.js | 2 +- src/components/Charts/index.less | 1 + 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/components/Charts/MiniArea/index.js b/src/components/Charts/MiniArea/index.js index bb8b5be0..3e0e2de0 100644 --- a/src/components/Charts/MiniArea/index.js +++ b/src/components/Charts/MiniArea/index.js @@ -41,7 +41,7 @@ class MiniArea extends PureComponent { height: height + 54, animate, plotCfg: { - margin: [36, 0, 30, 0], + margin: [36, 5, 30, 5], }, legend: null, }); @@ -74,28 +74,22 @@ class MiniArea extends PureComponent { }, }; - const view = chart.createView(); - view.tooltip({ + chart.tooltip({ title: null, crosshairs: false, map: { - name: 'y', + title: null, + name: 'x', + value: 'y', }, }); + const view = chart.createView(); view.source(data, dataConfig); view.area().position('x*y').color(color).shape('smooth') .style({ fillOpacity: 1 }); - chart.on('tooltipchange', (ev) => { - const item = ev.items[0]; - const { title } = item; - item.title = ''; - item.name = ''; - item.value = `${title} : ${item.value}`; - }); - if (line) { const view2 = chart.createView(); view2.source(data, dataConfig); diff --git a/src/components/Charts/MiniBar/index.js b/src/components/Charts/MiniBar/index.js index 023aff08..90d9ae7c 100644 --- a/src/components/Charts/MiniBar/index.js +++ b/src/components/Charts/MiniBar/index.js @@ -42,7 +42,7 @@ class MiniBar extends PureComponent { forceFit: fit, height: height + 54, plotCfg: { - margin: [36, 0, 30, 0], + margin: [36, 5, 30, 5], }, legend: null, }); diff --git a/src/components/Charts/index.less b/src/components/Charts/index.less index 4b8c47ae..19e13908 100644 --- a/src/components/Charts/index.less +++ b/src/components/Charts/index.less @@ -6,6 +6,7 @@ bottom: -34px; width: 100%; & > div { + margin: 0 -5px; overflow: hidden; } } -- GitLab