您可以将图表工具提示设为内容模板,然后在显示工具提示时创建图表。
演示
代码:
<script id="template" type="text/x-kendo-template">
<div id="myTooltip">
<span>Some Text here</span>
<div id="myChart"></div>
<span>hover the connectors, not showing tootip</span>
</div>
</script>
function CreateTooltipChart(){
// Satter line chart embedded in tooltip
$("#myChart").kendoChart({
chartArea: {
height: 200,
width: 310
},
title: {
text: "Charge current vs. charge time"
},
seriesDefaults: {
type: "scatterLine"
},
series: [{
data: [[10, 10], [15, 20], [20, 25], [32, 40]]
}],
xAxis: {
max: 35,
labels: {
format: "{0}m"
},
},
yAxis: {
max: 50,
labels: false
},
//tooltip for chart is set here
tooltip: {
visible: true,
format: "{1}% in {0} minutes"
}
});
}
// Tooltip on span element
var tooltip = $('.show-tooltip').kendoTooltip({
autoHide: false,
position: "right",
width: 312,
//height: 300,
show: function(e){
CreateTooltipChart();
},
content: kendo.template($("#template").html()),
}).data("kendoTooltip");