Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 538
Rajesh Avatar asked Nov 19 '25 23:11

Rajesh


1 Answers

In amcharts the field for the border color is stroke. You can set it eiter on the tooltip itself, on the tooltip.background or on the tooltip.label. For example like this:

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

You also can change the border width using strokeWidth:

series.tooltip.background.strokeWidth = 2;

Here is a working code pen.

like image 121
Samuel Philipp Avatar answered Nov 22 '25 12:11

Samuel Philipp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!