我正在使用c3.js制作图表。我必须使工具提示的内容可以被盗用。直到现在,只有当我将鼠标悬停在图表上时,工具提示才可见。我在点击工具提示中的链接时会显示一些信息。我从c3 documentation找不到任何帮助。下面显示了我正在处理的代码片段。C3图表 - 可点击的工具提示内容
$scope.timelineConfig.tooltip.contents = function (data, defaultTitleFormat, defaultValueFormat, color) {
var $$ = this, config = $$.config,
titleFormat = config.tooltip_format_title || defaultTitleFormat,
nameFormat = config.tooltip_format_name || function (name) { return name; },
valueFormat = config.tooltip_format_value || defaultValueFormat,
text, i, title, value;
text = "<div id='tooltip' class='d3-tip'>";
title = dates[data[0].index];
text += "<span class='info'><b><u>Date</u></b></span><br>";
text += "<span class='info'>"+ title +"</span><br>";
text += "<span class='info'><b><u>Features</u> : </b> " + features[data[0].index] + "</span><br>";
text += "<span class='info'><b><u>Enhancements</u> : </b> " + defects[data[0].index] + "</span><br>";
text += "</div>";
return text;
};
我必须使内容(<span><b><u>Features...</u></b></span>
)可点击。