AUTHOR: Veselina Raykova
DATE POSTED: October 08, 2018
In this sample you can see how to change the shape’s Visual Template dynamically (e.g. on a shape click). You can test the result of the implementation shown below applied to the Kendo Diagram widget here: http://dojo.telerik.com/UJizAfOr/3
For this purpose, you will need to:
function
my_circle(options) {
var
ns = kendo.dataviz.diagram;
group =
new
ns.Group({ autoSize:
true
});
circle =
ns.Circle({ radius: options.width / 2, fill: { color: options.fill.color } });
group.append(circle);
return
group;
}
my_rect(options) {
rect =
rect
ns.Rectangle({ height: options.height, width: options.width, fill: options.fill });
group.append(rect);
<
telerik:RadDiagram
ID
=
"diagram1"
runat
"server"
>
LayoutSettings
Enabled
"true"
></
ClientEvents
OnClick
"OnShapeClick"
/>
...
</
OnShapeClick(args) {
shape = args.item;
if
(shape
instanceof
kendo.dataviz.diagram.Shape) {
shape.redraw({ visual: my_circle });
shape.redrawVisual();
RadDiagram Client-side Events
RadDiagram Visual Templates
kendo.dataviz.diagram.Shape
Kendo Dataviz shape.redraw()
Resources Buy Try