asp.net mvc - Custom Telerik DataViz chart tooltip color -
i have chart many colors. tooltip should appear black or white depending on background color of chart's bar. option can think of handle series.name
. nothing works.
this code accurately put white or black piece of text onto screen tooltip:
.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>'; } #") )
however, once plug in #= series.name # #= value #
instead of bar
function breaks down , no longer works.
next, tried both sharedtemplate , template such (one @ time of course):
.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>
this didn't , instead displayed tooltip of "mytemplate".
is possible do? if not there kind of work around?
the answer set tooltip color on series itself:
.series(series => { series.column(new double[] { 1, 2, 3}).name("india").tooltip(t=>t.background("#fff")); series.column(new double[] { 4, 5, 6 }).name("russian federation").tooltip(t => t.background("#000")); series.column(new double[] { 7, 8, 9}).name("germany").tooltip(t => t.background("#fff")); })
Comments
Post a Comment