From cc1d7095ec6df622efbdaaabe3dec78ca3599d90 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 27 五月 2022 17:01:14 +0800
Subject: [PATCH] X轴自定义名称长度

---
 src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx |    9 +++++++++
 src/tabviews/custom/components/chart/antv-bar-line/index.jsx   |    6 ++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx
index 0b0c513..8a3a691 100644
--- a/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx
+++ b/src/menu/components/chart/antv-bar/chartcompile/formconfig.jsx
@@ -572,6 +572,15 @@
       initVal: card.max,
       required: false
     }, {
+      type: 'number',
+      key: 'XLimit',
+      min: 2,
+      label: '瀛楃闄愬埗',
+      tooltip: 'X杞存渶澶у瓧绗﹂檺鍒躲��',
+      initVal: card.XLimit || 11,
+      forbid: appType === 'mob',
+      required: false
+    }, {
       type: 'color',
       key: 'color',
       label: '鑹茬郴',
diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx
index 6c687f2..f45afc1 100644
--- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx
@@ -198,12 +198,14 @@
       _config.plot.$colors = colors
     }
 
+    let limit = _config.plot.XLimit || 11
+
     let xc = {label: {
       formatter: (val) => {
         if (!val || /^\s*$/.test(val)) return val
         let _val = `${val}`
-        if (_val.length <= 11) return val
-        return _val.substring(0, 8) + '...'
+        if (_val.length <= limit) return val
+        return _val.substring(0, limit) + '...'
       },
       style: { fill: _config.plot.color }
     }}

--
Gitblit v1.8.0