简体   繁体   English

自定义 Amcharts v4 工具提示边框颜色

[英]Customize Amcharts v4 tooltip border color

I've applied code like this:我已经应用了这样的代码:

var series = chart.series.push(new am4charts.LineSeries());
series.tooltip.getFillFromObject = false;
series.tooltip.background.fill = am4core.color("#fff");
series.tooltip.border.fill = am4core.color("#000");
series.tooltip.label.fill = am4core.color("#000");
series.tooltipText = "{date.formatDate('d MMM, yyyy')}: [bold]{value}";
series.dataFields.dateX = "date";
series.dataFields.valueY = "value";

But somehow tooltip is not loaded with border color.但不知何故工具提示没有加载边框颜色。

In amcharts the field for the border color is stroke .在 amcharts 中,边框颜色的字段是stroke You can set it eiter on the tooltip itself, on the tooltip.background or on thetooltip.label .你可以将它设置eiter在tooltip自己,在tooltip.background或在tooltip.label For example like this:例如像这样:

series.tooltip.background.stroke = am4core.color("#000");

You also can change the border width using strokeWidth :您还可以使用strokeWidth更改边框宽度:

series.tooltip.background.strokeWidth = 2;

Here is a working code pen.是一个工作代码笔。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM