Weird character in front of Highcharts tooltip ser

2019-04-03 18:58发布

I have a Highcharts chart which is, for some reason, showing odd characters before the series title only on the data point pop up. I am using the default popup and highcharts 4.0.1.

I currently set all series to have the title hi to ensure nothing in my code was messing this up. Also if I output countsGraph.series[0].name I also get hi.

What is causing this? Unfortunately I cannot make a fiddle at the moment as my access to HighCharts.com is playing up.

Here is how I create the series

// Create new series if requried
if (!series[c]) {
    series[c] = {
        name: "hi",
        data: []
    };
}

enter image description here

3条回答
放荡不羁爱自由
2楼-- · 2019-04-03 19:28

I had the same issue. Encoding in Notepad++ was set to 'UTF-8 without BOM'. When I switched it to 'UTF-8' it fixed it. Thanks!

UPDATE - that had some undesirable effects on other stuff, so I ended up adding to the html:

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" / >

and that fixed it all

查看更多
对你真心纯属浪费
3楼-- · 2019-04-03 19:36

the simple solution to all the problem is using a tooptip

code is as follow:

tooltip: {
    pointFormat: '{series.name}: <b>{point.y}</b><br/>',
    shared: true
},
series: {
    code here 
}

workable and easy solution to remove the weird character on hover on highcharts.

查看更多
虎瘦雄心在
4楼-- · 2019-04-03 19:41

Most probably you are using different coding than UTF-8. You can simply remove that character, by changing pointFormat, from:

<span style="color:{series.color}">\u25CF</span> {series.name}: <b>{point.y}</b><br/>

to:

<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b><br/>

Or, as just @Adam Goodwin pointed out, set default format in your options:

<span style="color:{series.color}">\u25CF</span> {series.name}: <b>{point.y}</b><br/>
查看更多
登录 后发表回答