feat: 添加字号变化 width的变化

This commit is contained in:
zhangyu
2022-03-23 15:01:22 +08:00
parent 88e3553c51
commit 255c49dcad
3 changed files with 29 additions and 4 deletions

View File

@@ -53,7 +53,7 @@ import { getMetricTypeValue } from '@/components/common/js/tools'
import chartDataFormat from '@/components/charts/chartDataFormat'
import { randomcolor } from '@/components/common/js/radomcolor/randomcolor'
import { initColor } from '@/components/chart/chart/tools'
import fontWidth from '@/components/chart/chart/options/fontWidth'
// import fontWidth from '@/components/chart/chart/options/fontWidth'
export default {
name: 'chart-stat',

View File

@@ -1,5 +1,20 @@
const fontWidth = {
0: 10,
A: 7.5
// 字号大小 12 13 14 15
0: { defaultWidth: 7.781, addWidth: 0.6485 }, // 7.781 8.422 9.078 9.719 0.656 0.046
1: { defaultWidth: 7.781, addWidth: 0.6485 }, // 7.781 8.422 9.078 9.719
2: { defaultWidth: 7.781, addWidth: 0.6485 }, // 7.781 8.422 9.078 9.719
3: { defaultWidth: 7.781, addWidth: 0.6485 }, // 7.781 8.422 9.078 9.719
4: { defaultWidth: 7.781, addWidth: 0.6485 }, // 7.781 8.422 9.078 9.719
5: { defaultWidth: 7.781, addWidth: 0.6485 }, // 7.781 8.422 9.078 9.719
6: { defaultWidth: 7.781, addWidth: 0.6485 }, // 7.781 8.422 9.078 9.719
7: { defaultWidth: 7.781, addWidth: 0.6485 }, // 7.781 8.422 9.078 9.719
8: { defaultWidth: 7.781, addWidth: 0.6485 }, // 7.781 8.422 9.078 9.719
9: { defaultWidth: 7.781, addWidth: 0.6485 }, // 7.781 8.422 9.078 9.719,
space: { defaultWidth: 7.781, addWidth: 0.938 },
A: 7.5,
other: 3,
fontHeight: 1.5, // 字体大一px 高度加1.5
defaultHeight: 18,
numMinus: 0.0015
}
export default fontWidth

View File

@@ -66,6 +66,9 @@
</el-dropdown>
</div>
<guide :show-dialog="showGuide" @dialogClosed="dialogClosed" @close="showGuide = false"></guide>
<span v-for="item in fontData" :key="item">
<span class="temp-dom" :class="`temp-dom--${fontSzie}`" v-for="fontSzie in [12,13,14,15]" :key="fontSzie">{{item}}</span>
</span>
</div>
</template>
@@ -116,7 +119,8 @@ export default {
permission: 'header_add_rule'
}
],
showGuide: false
showGuide: false,
fontData: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ' ', '@', '$', '-']
}
},
methods: {
@@ -197,6 +201,12 @@ export default {
}
},
mounted () {
for (let i = 65; i < 91; i++) {
this.fontData.push(String.fromCharCode(i))
}
for (let i = 97; i < 123; i++) {
this.fontData.push(String.fromCharCode(i))
}
this.$i18n.locale = this.language
if (localStorage.getItem('nz-token')) {
this.initEvent()