Have already followed the instructions
But still does not show chart.
Showing the alert ("success");
View Index
<div class="row" style="padding:10px;">
<button id="Button1" type="button" class="btn btn-primary">OneX</button>
........
<div id="DiagramPartialView" style="width:600px;height:400px;">
</div>
......
<script type="text/javascript">
$(document).ready(function () {
$("#Button1").click(function () {
$.ajax({
url: '@Url.Action("DiagramPartialView", "Diagram")',
dataType: "html",
type: "GET",
contentType: "application/html; charset=utf-8",
success: function (result) {
//alert("success");
//$("#partialView").html(result);
alert("success");
$("#DiagramPartialView").html(result);
//initialize a diagram
ej.widget.init($("#DiagramPartialView"));
},
error: function (xhr) {
alert("error");
}
});
});
------------------
Controller
public ActionResult DiagramPartialView(string pass = "")
{
DiagramProperties model = new DiagramProperties();
model.Height = "350px";
model.Width = "100%";
model.PageSettings.ScrollLimit = ScrollLimit.Diagram;
model.PageSettings.MultiplePage = false;
model.Layout.Type = LayoutTypes.OrganizationalChart;
model.Layout.HorizontalSpacing = 30;
model.Layout.VerticalSpacing = 30;
model.Layout.Margin.Top = 15;
model.Layout.Margin.Left = 0;
model.Layout.GetLayoutInfo = "getLayoutInfo";
model.DataSourceSettings.DataSource = GetOrganizationChart();
model.DataSourceSettings.Parent = "Phase";
model.DataSourceSettings.Id = "Id";
model.Create = "create";
Dictionary<string, object> addInfo = new Dictionary<string, object>();
addInfo.Add("orientation", "vertical");
addInfo.Add("type", "alternate");
model.DefaultSettings.Node = new Node()
{
Constraints = NodeConstraints.Select | NodeConstraints.PointerEvents,
Width = 110,
Height = 40,
BorderColor = "black",
AddInfo = addInfo
};
Label label = new Label() { FontColor = "#ffffff", Margin = new LabelMargin() { Left = 10, Right = 10 } };
model.DefaultSettings.Node.Labels.Add(label);
model.DefaultSettings.Connector = new Connector()
{
Constraints = ConnectorConstraints.None,
LineColor = "#000000",
Segments = new Collection() { new Segment(Segments.Orthogonal) },
TargetDecorator = new Decorator() { Shape = DecoratorShapes.None }
};
model.SelectedItems.Constraints = ~SelectorConstraints.Rotator;
model.SelectionChange = "selectionChanged";
model.Click = "diagramClick";
model.Tool = Tool.SingleSelect | Tool.ZoomPan;
model.SnapSettings.SnapConstraints = SnapConstraints.None;
model.EnableContextMenu = false;
model.Tool = Tool.SingleSelect;
model.NodeTemplate = "nodeTemplate";
ViewData["diagramModelP"] = model;
return PartialView();
}
------------------------------------------------
DiagramPartialView
<div>
<h1>Partial View</h1>
</div>
<div class="row">
@Html.EJ().Diagram("PartialView", ViewData["diagramModelP"] as Syncfusion.JavaScript.DataVisualization.Models.DiagramProperties)
</div>
-------------------------
Thank you
MJ.