删除 highcharts 数据标签上的 shadow/background 发光?
Remove shadow/background glow on highcharts data label?
如果您查看我的 http://jsfiddle.net/WOUNDEDStevenJones/oe1vcmqj/1/,图表上的红色标签背后有微妙的白光(至少 Chrome 和 FF)。我如何去除那个白光?或者最坏的情况至少将颜色更改为相同的蓝色以便融入其中?
我试过使用 shadow
、backgroundColor
和它们的 API (http://api.highcharts.com/highcharts#plotOptions.column.dataLabels) 中的其他属性,但无法弄清楚是什么定义了它在红色文字后面发光。
plotOptions: {
columnrange: {
dataLabels: {
enabled: true,
color: 'red',
inside: false,
xHigh: -45,
xLow: -9999999,
shadow: "#ff0000",
formatter: function () {
if (this.point.high) {
var myDate = new Date(this.y);
var newDateMs = Date.UTC(myDate.getUTCFullYear(),myDate.getUTCMonth(),myDate.getUTCDate());
return '<b>' + Highcharts.dateFormat('%m/%e',newDateMs) + '</b>';
} else {
return null;
}
}
}
}
}
使用 text-shadow:none !important;
作为标签 tspan
CSS
tspan{
text-decoration:none;
text-shadow:none !important;
}
将 dataLabels.styles.textShadow
设置为 false
。
plotOptions: {
columnrange: { // or general options: "series: { ... }"
dataLabels: {
enabled: true,
color: 'red',
style: {
textShadow: false
}
}
}
},
演示:http://jsfiddle.net/oe1vcmqj/2/
编辑:
自 Highcharts 5.0.3 起,选项名称为 textOutline
。
plotOptions: {
columnrange: { // or general options: "series: { ... }"
dataLabels: {
enabled: true,
color: 'red',
style: {
textOutline: false
}
}
}
},
演示:http://jsfiddle.net/oe1vcmqj/49/
编辑 v2.0:
自 Highcharts 5.0.13 起,textOutline
选项应为 string
,因此要禁用大纲,请设置 textOutline: 'none'
.
plotOptions: {
columnrange: { // or general options: "series: { ... }"
dataLabels: {
enabled: true,
color: 'red',
style: {
textOutline: 'none'
}
}
}
},
dataLabels: {
enabled: true,
format: '{point.y}',
style: {
textOutline: false
}
},
对我有用...
dataLabels: {
enabled: true,
color: 'white',
style: {
// textShadow: false
textOutline: false
}
如果您查看我的 http://jsfiddle.net/WOUNDEDStevenJones/oe1vcmqj/1/,图表上的红色标签背后有微妙的白光(至少 Chrome 和 FF)。我如何去除那个白光?或者最坏的情况至少将颜色更改为相同的蓝色以便融入其中?
我试过使用 shadow
、backgroundColor
和它们的 API (http://api.highcharts.com/highcharts#plotOptions.column.dataLabels) 中的其他属性,但无法弄清楚是什么定义了它在红色文字后面发光。
plotOptions: {
columnrange: {
dataLabels: {
enabled: true,
color: 'red',
inside: false,
xHigh: -45,
xLow: -9999999,
shadow: "#ff0000",
formatter: function () {
if (this.point.high) {
var myDate = new Date(this.y);
var newDateMs = Date.UTC(myDate.getUTCFullYear(),myDate.getUTCMonth(),myDate.getUTCDate());
return '<b>' + Highcharts.dateFormat('%m/%e',newDateMs) + '</b>';
} else {
return null;
}
}
}
}
}
使用 text-shadow:none !important;
作为标签 tspan
CSS
tspan{
text-decoration:none;
text-shadow:none !important;
}
将 dataLabels.styles.textShadow
设置为 false
。
plotOptions: {
columnrange: { // or general options: "series: { ... }"
dataLabels: {
enabled: true,
color: 'red',
style: {
textShadow: false
}
}
}
},
演示:http://jsfiddle.net/oe1vcmqj/2/
编辑:
自 Highcharts 5.0.3 起,选项名称为 textOutline
。
plotOptions: {
columnrange: { // or general options: "series: { ... }"
dataLabels: {
enabled: true,
color: 'red',
style: {
textOutline: false
}
}
}
},
演示:http://jsfiddle.net/oe1vcmqj/49/
编辑 v2.0:
自 Highcharts 5.0.13 起,textOutline
选项应为 string
,因此要禁用大纲,请设置 textOutline: 'none'
.
plotOptions: {
columnrange: { // or general options: "series: { ... }"
dataLabels: {
enabled: true,
color: 'red',
style: {
textOutline: 'none'
}
}
}
},
dataLabels: {
enabled: true,
format: '{point.y}',
style: {
textOutline: false
}
},
对我有用...
dataLabels: {
enabled: true,
color: 'white',
style: {
// textShadow: false
textOutline: false
}