我正在使用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>
)可點擊。