I am in the process of preparing Org Chart in MVC diagram. Everything works fine. I just need to have clickable link for every employee rectangle box in diagram.
Also, Diagram have TextBlock,image and etc. Does it have anything like LinkBlock to have link or href block to redirect to something else? please add some code for the same.
Can we have a scroll bar for the entire diagram to go left and right and top to bottom. Please add some code snippet to scroll the diagram to see all the people instead of zoom by default.
Here is my rectangle that I need to have clickable link.
g.append(new dataviz.diagram.Rectangle({
width: 320,
height: 125,
stroke: {
width: 0
},
fill: {
gradient: {
type: "linear",
stops: [
{
color: dataItem.ColorScheme,
offset: 0,
opacity: 0.5
}, {
color: dataItem.ColorScheme,
offset: 1,
opacity: 1
}
]
}
}
}));
Hi I have problem with export diagram to SVG.
I get error message:
This page contains the following errors: error on line 1 at column 3494: EntityRef: expecting ';'
Below is a rendering of the page up to the first error.
I tried kendo version 2015.2.624 and v2015.2.902. The result is the same.
I tried this code:
$("#exportSvg").click(function () {
var diagram = $("#diagram").getKendoDiagram();
diagram.exportSVG().done(function (data) {
kendo.saveAs({
dataURI: data,
fileName: "diagram.svg"
});
});
});
and this code with proxyURL:
$("#exportSvg").click(function () {
var diagram = $("#diagram").getKendoDiagram();
diagram.exportSVG().done(function (data) {
kendo.saveAs({
dataURI: data,
fileName: "diagram.svg",
proxyURL: "<%= Url.Action("ExportSave", "OrganizacneSchemy") %>"
});
});
});
Where is the problem ?
Thanks
Hello
Perhaps telerik diagrams are quite good, but I can't find out how to reload a diagram?
I have a diagram like this:
@(Html.Kendo().Diagram()
.Name("diagram")
.DataSource(dataSource => dataSource
.Read(read => read
.Action("GetLinkedPersonsData", "KartotekaKlientow")
)
.Model(m => m.Children("Items"))
)
.Editable(false)
.Layout(l => l.Type(DiagramLayoutType.Layered))
.ShapeDefaults(sd => sd
.Visual("LinkedPersonsTemplate")
)
.ConnectionDefaults(cd => cd
.Stroke(s => s
.Color("#979797")
.Width(2)
)
)
)
and when I click I want the diagram to reload and get new data without refreshing the page. It would be also solution to inject new data into diagram.
Is there any way to to any of these?
Hello All,
I am just trying to see the code in the Kendo examples for diagram implementation that I have downloaded recently (Latest release telerik.ui.for.aspnetmvc.2015.2.624.commercial), But when I run the solution locally and browse the 'Editing' section of the diagram I do get the shapes and connections as in demo site but I am not able to add a new shape (or new rectangle) to the diagram. When I press the rectangle icon in tool bar I get a error in browser console as follows.
Chrome: kendo.all.min.js:68 Uncaught TypeError: Cannot read property 'gradient' of undefined)
FireFox: kendo.all.min.js:68:8298 TypeError: t is undefined
Also other options in the tool bar are also not working.
Hi
I am trialling your product with a view to purchasing soon, but am having some issues with the default rendering of connections. I am using Layout Type and Down SubType. I've attached two files. One is the vertical layout that I am trying to achieve, but as you can see the connections don't look great. The second is a horizontal layout which seems to render much better, but isn't what I want.
Is there anything I can do to correct this. I tried adding new connectors to the shape, but can't work out what should go in the Position property in MVC.
Thanks
Jared
Hi
I am trying to add a custom connector to a rectangle in MVC, but am struggling top work out how to do it. This is the code I am using;
.ShapeDefaults(sd => sd.Connectors(o =>
{
o.Add().Name("top");
o.Add().Name("right");
o.Add().Name("bottom");
o.Add().Name("left");
o.Add().Name("auto");
o.Add().Name("bottomRight");
o.Add().Name("topRight");
o.Add().Name("bottomLeft");
o.Add().Name("topLeft");
o.Add().Name("topRightMiddle").Position("function(shape) { var p = shape.bounds().top(); return shape._transformPoint(new kendo.dataviz.diagram.Point(p.x + 15, p.y)); }");
})
When I run this, none of the connectors are added. When I run it without the 'topRightMiddle' connector, it works fine and all the named connectors are added. How should the 'Position' method parameter be constructed?
Thanks
Jared
Hi,
I have created a KendoDiagram using the code below. The data returned is a bit longer than below but esentially it returns 30 items at 3 levels of hierarchy. Everything works great if I have the Stroke Width set to 0. However
if the width is set to >0 the connectors look really untidy as can be seen in the attachment.
Is it possible to change the connector so that instead of going into the top centre of the shape they go into the centre left of the shape?
Thanks
Controller
public JsonResult GetDiagramData()
{
var coo = new ManagementStructure() { Name = "AS", JobRole = "Chief" };
var aj = new ManagementStructure { Name = "AJ", JobRole = "Regional" };
var cd = new ManagementStructure { Name = "CD", JobRole = "Regional" };
var kf = new ManagementStructure { Name = "KF", JobRole = "Regional" };
var mc = new ManagementStructure { Name = "MC", JobRole = "Regional" };
var sm = new ManagementStructure { Name = "SM", JobRole = "Regional" };
var te = new ManagementStructure { Name = "TE", JobRole = "Regional" };
coo.Items.Add(aj);
coo.Items.Add(cd);
aj.Items.Add(new ManagementStructure { Name = "KM", JobRole = "Area" });
aj.Items.Add(new ManagementStructure { Name = "LW", JobRole = "Area" });
cd.Items.Add(new ManagementStructure { Name = "AG", JobRole = "Area" });
cd.Items.Add(new ManagementStructure { Name = "DE", JobRole = "Area" });
cd.Items.Add(new ManagementStructure { Name = "DT", JobRole = "Area" });
cd.Items.Add(new ManagementStructure { Name = "FT", JobRole = "Area" });
cd.Items.Add(new ManagementStructure { Name = "JD", JobRole = "Area" });
cd.Items.Add(new ManagementStructure { Name = "NM", JobRole = "Area" });
cd.Items.Add(new ManagementStructure { Name = "PF", JobRole = "Area" });
cd.Items.Add(new ManagementStructure { Name = "RW", JobRole = "Area" });
cd.Items.Add(new ManagementStructure { Name = "SF", JobRole = "Area" });
kf.Items.Add(new ManagementStructure { Name = "AC", JobRole = "Area" });
kf.Items.Add(new ManagementStructure { Name = "EW", JobRole = "Area" });
kf.Items.Add(new ManagementStructure { Name = "HS", JobRole = "Area" });
var managers = new List<ManagementStructure> { coo };
return Json(managers, JsonRequestBehavior.AllowGet);
}
<script>
function visualTemplate(options) {
var dataviz = kendo.dataviz;
var g =
new
dataviz.diagram.Group({
autoSize:
true
});
var dataItem = options.dataItem;
g.append(
new
dataviz.diagram.Rectangle({
width: 150,
height: 50,
stroke: {
width: 0
},
background:
"#1696d3"
}));
g.append(
new
dataviz.diagram.TextBlock({
text: dataItem.Name,
x: 5,
y: 10,
color:
"#fff"
}));
g.append(
new
dataviz.diagram.TextBlock({
text: dataItem.JobRole,
x: 5,
y: 30,
color:
"#fff"
}));
return
g;
}
</script>
<h2>Test Hierarchy</h2>
<div id=
"canvas"
class
=
"diagram-wrapper"
style=
"margin: auto;"
>
@(Html.Kendo().Diagram()
.Name(
"diagram"
)
.DataSource(dataSource => dataSource
.Read(read => read.Action(
"GetDiagramData"
,
"Home"
)).Model(m => m.Children(
"Items"
))
)
.Layout(l => l.Type(DiagramLayoutType.Tree))
.Layout(l => l.Subtype(DiagramLayoutSubtype.Tipover))
.ShapeDefaults(sd => sd.Visual(
"visualTemplate"
).Stroke(s => s.DashType(
"dashDot"
)).Editable(
false
).Rotatable(
false
).Resizable(
false
)).Draggable(
false
)
.ConnectionDefaults(cd => cd.Stroke(s => s.Color(
"#979797"
).Width(0)))
)
</div>
<script>
$(function () {
// Notice that the Name() of the diagram is used to get its client-side instance
var diagram = $(
"#diagram"
).data(
"kendoDiagram"
);
diagram.zoom(0.75);
});
</script>