最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Weird character in front of Highcharts tooltip series names - Stack Overflow

programmeradmin3浏览0评论

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 is playing up.

Here is how I create the series

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

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: []
    };
}

Share Improve this question asked Jun 3, 2014 at 10:09 ChrisChris 27.4k49 gold badges206 silver badges357 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 8

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/>

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

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.

发布评论

评论列表(0)

  1. 暂无评论