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的」的提示。
這可能嗎?如果沒有,是否有任何解決方法?