簡體   English   中英

Highchart不顯示Unicode字符

[英]Highchart does not display unicode character

當標題或名稱包含unicode字符時,將這樣顯示。 我想顯示法語。 http://i.stack.imgur.com/cwpES.png

{ 
       min: 0,
       max:3000,
       tickAmount: 6,
       tickInterval: 600,
      title: {
         text: 'Température (°C)',
         style: {
            color: '#7CB5EC',
            fontFamily: 'Trebuchet MS'
         }
      },
      labels: {
         format: '{value}',
         style: {
            color: Highcharts.getOptions().colors[0]
         }
      },
      opposite: true
   }

在html的meta標記中使用meta charset =“ utf-8”。...只需放在html標頭中

<meta charset="utf-8" />

我解決了我的問題。 我使用notepad ++重新編碼該文件。 缺省的Eclipse編碼UTF-8無法正常工作。

在高圖上添加標題時,嘗試將useHTML屬性設置為true

 title: {
            useHTML: true,
            text: "yourText"
        }

它適用於所有瀏覽器。

向dataLabels useHTML添加屬性:true

$(function() {
  $('#container').highcharts({
    series: [{
      dataLabels: {
        enabled: true,
        useHTML: true,
        borderWidth: 1,
        borderColor: 'red',
        style: {
            color: 'black',
            textShadow: ''
          }
      },
      type: 'pie',
      data: [{
        name: 'a',
        y: 4
      }, {
        name: 'b',
        y: 1
      },{
        name: 'c',
        y: 1
      }],

    }]
  });
});

如果您提供的內容包含特殊字符“'”,highcharts將無法生成圖像。 快速解決方案是替換字符“'”。 我假設測試中的“'”與lib驗證沖突,后者可能也包含相同的字符。

 text=text.replace("'", "’")

這解決了生成圖像(不顯示該字符)的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM