Ver código fonte

图表标题fix

cxmo 9 meses atrás
pai
commit
acbd01690a
1 arquivos alterados com 4 adições e 6 exclusões
  1. 4 6
      src/views/ppt_manage/mixins/pptMixins.js

+ 4 - 6
src/views/ppt_manage/mixins/pptMixins.js

@@ -543,7 +543,8 @@ export default {
         let titleHTML = null
         //中英文发布页需设置title换行
         //一行可容纳的中文字体数
-        let count = parseInt($(`#${refName}`)[0].offsetWidth / 19)*2;
+        const fontSize = chartTheme?chartTheme.titleOptions.style.fontSize:1
+        let count = parseInt($(`#${refName}`)[0].offsetWidth / fontSize)*1.75
         let {total,newStr} = getStrSize(options.MyChartTitle,count)
         const isPublish = this.$route.path==='/pptpublish'||this.$route.path==='/pptenpublish'
         if(isShowTitle){
@@ -551,12 +552,11 @@ export default {
             text-align:${chartTheme&&chartTheme.titleOptions.align};
             font-size:${chartTheme&&chartTheme.titleOptions.style.fontSize}px;
             color:${chartTheme&&chartTheme.titleOptions.style.color};
-            height:18px;
+            min-height:18px;
           ">
             ${options.MyChartTitle}
           </div>`
         }
-        const titleOption = isPublish&&isShowTitle?{marginTop:25}:{}
         let SpecialOption = {
           chart: {
             ...defaultOpts.chart,
@@ -566,7 +566,6 @@ export default {
             backgroundColor: "rgba(0,0,0,0)",
             renderTo:$(`#${refName}`)[0],
             ...options.chart||{},
-            ...titleOption
           },
           legend: {
             ...defaultOpts.legend,
@@ -575,9 +574,8 @@ export default {
           colors: options.colors||chartTheme&&chartTheme.colorsOptions||defaultOpts.colors,
           title: isPublish?{
             text: isShowTitle?newStr:null,
-            margin:0,
+            margin:5,
             useHTML:false,
-            floating:true,
             style:{...chartTheme&&chartTheme.titleOptions.style},
             align: (chartTheme&&chartTheme.titleOptions.align) || (total>count?'left':'center'),
           }:{