1
我有许多颜色的图表。工具提示应该显示为黑色或白色,具体取决于图表栏的背景颜色。我能想到的唯一选择是与series.name
一起处理。但没有任何工作。自定义Telerik DataViz图表工具提示颜色
此代码并准确地把一种白色或黑色的一段文字在屏幕上的提示:
.Tooltip(tooltip =>
tooltip.Visible(true).Template("# if ((series.name === 'foo') || (series.name === 'bah')) { return '<strong style=\"color: black\">bar</strong>'; } else { return '<strong style=\"color: white\">bar</strong>'; } #")
)
但是,一旦我插上#= series.name # #= value #
而不是bar
功能坏了,它不再作品。
接下来,我都尝试SharedTemplate和模板本身(一个在课程的时间):
.Tooltip(tooltip =>
tooltip.Visible(true).Template("mytemplate")
tooltip.Visible(true).SharedTemplate("mytemplate")
)
<script id="mytemplate" type="text/x-kendo-template">
# if ((series.name === 'foo') || (series.name === 'bah')) { #
<strong style="color: black">bar</strong>
# } else { #
<strong style="color: white">bar</strong>
# } #
</script>
这并没有做任何事情,而不是显示“MyTemplate的”的提示。
这可能吗?如果没有,是否有任何解决方法?