I want to break a line in a tooltip of highcharts. I added br tag to do so and it works fine. The only problem is that I am trying to perform localization on that particular string also.
gettextCatalog.getString("Click the bar to view <br/>detailed information about <br/>events for the time range <br/>represented by the bar.");
Using br tag prevents IE11 and edge browser to localise that string due to <> symbols. So i need to find a way of breaking a line without using
tag. I tried lte and gte to replace <> tag. It enables localization in all browsers but does not perform line break.
I even tried:
gettextCatalog.getString("Click the bar to view \n detailed information about <br/>events for the time range");
higcharts-tooltip code:
tooltip: {
formatter: function () {
var content;
var nameLabel;
content = "<strong>" + gettextCatalog.getString("Event Time") + ":</strong> " + Highcharts.dateFormat("%H:%M:%S", this.x) + "<br/>";
nameLabel = this.series.name;
if (nameLabel === highCardinalitySelector) {
nameLabel = otherLabel;
}
content += "<strong>" + $scope.eventfieldName + ":</strong> " + nameLabel + "<br/><strong>" + eventCountTypeLabel + ":</strong> " + this.y.toFixed(decimals) + "<br/>"; // jscs:ignore maximumLineLength
if ($scope.chartType == "Stacked Bar 2D") {
content += "<strong>" + gettextCatalog.getString("Total") + ":</strong> " + this.point.stackTotal.toFixed(decimals) + "<br/>";
}
content += "<br/>";
content += gettextCatalog.getString("Click the bar to view" + String.fromCharCode(13) + String.fromCharCode(10) + "\n detailed information about \nevents for the time range \n represented by the bar."); // jscs:ignore maximumLineLength
return content;
},
style: {
color: "#333",
fontSize: "11px",
padding: "8px"
},
borderColor: "#CCC",
followPointer: true
},
I looked through the following links and tried out the suggested solutions but nothing seems to work. How can I add line break to html text without using any html tag
Give a line break without using <br/>
Is there any other way to add line break in a string ? Please help.
` tag. https://developers.whatwg.org/text-level-semantics.html#the-br-element – Rob May 16 '17 at 19:27
tag. – AmCurious May 16 '17 at 19:36
` is causing the problem. Mine is a comment on your usage of of the tag. – Rob May 16 '17 at 19:38