Highcharts工具提示系列名称前面的奇怪角色

Chr*_*ris 16 javascript charts highcharts

我有一张Highcharts图表,出于某种原因,只有在数据点弹出时才会在系列标题之前显示奇数字符.我使用默认弹出窗口和highcharts 4.0.1.

我目前设置所有系列都有标题,hi以确保我的代码中没有任何东西弄乱这个.如果我输出countsGraph.series[0].name我也得到hi.

是什么造成的?不幸的是,由于我对HighCharts.com的访问正在播放,我现在无法做一个小提琴.

这是我创建系列的方式

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

在此输入图像描述

Paw*_*Fus 8

很可能你使用的编码不同于UTF-8.您可以通过更改以下内容来删除该字符pointFormat:

<span style="color:{series.color}">\u25CF</span> {series.name}: <b>{point.y}</b><br/>
Run Code Online (Sandbox Code Playgroud)

至:

<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b><br/>
Run Code Online (Sandbox Code Playgroud)

或者,正如刚才@Adam Goodwin指出的那样,在您的选项中设置默认格式:

<span style="color:{series.color}">\u25CF</span> {series.name}: <b>{point.y}</b><br/>
Run Code Online (Sandbox Code Playgroud)

  • 我也有这个问题,奇怪的是我能够通过将`pointFormat`显式设置为默认值来修复它 - 即带有*\u25CF`字符的**. (2认同)

Sha*_*e N 7

我遇到过同样的问题.Notepad ++中的编码设置为'无BOM的UTF-8'.当我把它切换到'UTF-8'时,它就修好了.谢谢!

更新 - 这对其他东西有一些不良影响,所以我最终添加到html:

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

并解决了这一切