void INCustomRequestCallback.OnCustomRequestCallback(NAspNetThinWebControl control, NRequestContext context, string argument) { NThinDiagramControl diagramControl = (NThinDiagramControl)control; NDrawingDocument document = diagramControl.Document; NDrawingDocumentHelper helper = new NDrawingDocumentHelper(document); Dictionary <string, string> settings = helper.ParseSettings(argument); DiagramRenderer renderer = new DiagramRenderer(); switch (settings["command"]) { case "RandomTree6Levels": renderer.CreateTree(document, 6, 3); break; case "RandomTree8Levels": renderer.CreateTree(document, 8, 2); break; } // Layout the diagram renderer.ApplyLayout(document, settings); // Resize document to fit all shapes document.SizeToContent(); // Update the view diagramControl.UpdateView(); }
void INCustomRequestCallback.OnCustomRequestCallback(NAspNetThinWebControl control, NRequestContext context, string argument) { NThinDiagramControl diagramControl = (NThinDiagramControl)control; InitDocument(diagramControl.Document, Type.GetType(argument)); control.UpdateView(); }
void INCustomRequestCallback.OnCustomRequestCallback(NAspNetThinWebControl control, NRequestContext context, string argument) { NThinChartControl chartControl = (NThinChartControl)control; NChart chart = chartControl.Charts[0]; NBarSeries bar = (NBarSeries)chart.Series[0]; bar.DataLabelStyles.Clear(); switch (argument) { case "ShowDataLabels": { bar.DataLabelStyle.Visible = true; } break; case "HideDataLabels": { bar.DataLabelStyle.Visible = false; } break; } // update the control and toolbar chartControl.Update(); }
void INCustomRequestCallback.OnCustomRequestCallback(NAspNetThinWebControl control, NRequestContext context, string argument) { NThinChartControl chartControl = (NThinChartControl)control; // make sure chart is recalculated chartControl.RecalcLayout(); NChart chart = chartControl.Charts[0]; NStockSeries stock = (NStockSeries)chart.Series[0]; switch (argument) { case "LastWeek": { DateTime dt = DateTime.FromOADate((double)stock.XValues[stock.XValues.Count - 1]); chart.Axis(StandardAxis.PrimaryX).PagingView.ZoomIn(new NRange1DD(dt.AddDays(-7).ToOADate(), dt.ToOADate()), 0.00001); } break; case "LastMonth": { DateTime dt = DateTime.FromOADate((double)stock.XValues[stock.XValues.Count - 1]); chart.Axis(StandardAxis.PrimaryX).PagingView.ZoomIn(new NRange1DD(dt.AddMonths(-1).ToOADate(), dt.ToOADate()), 0.00001); } break; case "LastYear": chart.Axis(StandardAxis.PrimaryX).PagingView.Enabled = false; break; } chartControl.Update(); }
void INCustomRequestCallback.OnCustomRequestCallback(NAspNetThinWebControl control, NRequestContext context, string argument) { NThinDiagramControl diagramControl = (NThinDiagramControl)control; NDrawingDocument document = diagramControl.Document; NDrawingDocumentHelper helper = new NDrawingDocumentHelper(document); Dictionary <string, string> settings = helper.ParseSettings(argument); // Create and configure the layout NSingleCycleLayout layout = new NSingleCycleLayout(); helper.ConfigureLayout(layout, settings); // Get the shapes to layout NNodeList shapes = document.ActiveLayer.Children(NFilters.Shape2D); // Layout the shapes layout.Layout(shapes, new NDrawingLayoutContext(document)); // Resize document to fit all shapes document.SizeToContent(); // Update the view diagramControl.UpdateView(); }
void INCustomRequestCallback.OnCustomRequestCallback(NAspNetThinWebControl control, NRequestContext context, string argument) { NThinDiagramControl diagramControl = (NThinDiagramControl)control; NDrawingDocument document = diagramControl.Document; string[] args = argument.Split(','); string cityName = args[0]; float x = Single.Parse(args[1], CultureInfo.InvariantCulture); float y = Single.Parse(args[2], CultureInfo.InvariantCulture); if (document.Tag is NPointElement) { ((NPointElement)document.Tag).StyleSheetName = String.Empty; document.Tag = null; } NLayer cityLayer = diagramControl.Document.Layers.GetChildByName("cities") as NLayer; if (cityLayer != null) { // Apply the new style to the newly zoomed city NMapLabelsShape labelsShape = (NMapLabelsShape)cityLayer.GetChildAt(0); NMapPointLabel city = (NMapPointLabel)labelsShape.MapLabels.GetChildByName(cityName); city.StyleSheetName = "ZoomedCity"; // Remember the currently highlighted city in the document's tag document.Tag = city; } diagramControl.View.Layout = CanvasLayout.Normal; diagramControl.Zoom(2, new NPointF(x, y)); }
void INCustomRequestCallback.OnCustomRequestCallback(NAspNetThinWebControl control, NRequestContext context, string argument) { NThinDiagramControl diagramControl = (NThinDiagramControl)control; NDrawingDocument document = diagramControl.Document; NDrawingDocumentHelper helper = new NDrawingDocumentHelper(document); Dictionary <string, string> settings = helper.ParseSettings(argument); // Create and configure the layout NSpringLayout layout = new NSpringLayout(); layout.BounceBackForce.Padding = 100f; layout.GravityForce.AttractionCoefficient = 0.2f; layout.BounceBackForce.Enabled = Boolean.Parse(settings["BounceBackForce"]); layout.GravityForce.Enabled = Boolean.Parse(settings["GravityForce"]); layout.ElectricalForce.NominalDistance = Single.Parse(settings["NominalDistance"]); layout.SpringForce.LogBase = helper.ParseFloat(settings["LogBase"]); layout.SpringForce.SpringForceLaw = (SpringForceLaw)Enum.Parse(typeof(SpringForceLaw), settings["SpringForceLaw"]); // Get the shapes to layout NNodeList shapes = document.ActiveLayer.Children(NFilters.Shape2D); // Layout the shapes layout.Layout(shapes, new NDrawingLayoutContext(document)); // Resize document to fit all shapes document.SizeToContent(); // Update the view diagramControl.UpdateView(); }
void INCustomRequestCallback.OnCustomRequestCallback(NAspNetThinWebControl control, NRequestContext context, string argument) { NThinDiagramControl diagramControl = (NThinDiagramControl)control; string[] args = argument.Split(','); NDataGrouping dataGrouping = null; switch (args[0]) { case "EqualDistribution": dataGrouping = new NDataGroupingEqualDistribution(); break; case "EqualInterval": dataGrouping = new NDataGroupingEqualInterval(); break; case "Optimal": dataGrouping = new NDataGroupingOptimal(); break; default: throw new Exception("New data grouping type?"); } dataGrouping.RoundedRanges = Boolean.Parse(args[1]); MapRenderer mapRenderer = new MapRenderer(); mapRenderer.InitDocument(diagramControl.Document, dataGrouping); diagramControl.UpdateView(); diagramControl.AddCustomClientCommand("UpdateLegend"); }
void INCustomRequestCallback.OnCustomRequestCallback(NAspNetThinWebControl control, NRequestContext context, string argument) { NThinDiagramControl diagramControl = (NThinDiagramControl)control; NDrawingDocument document = diagramControl.Document; int index = Int32.Parse(argument); MapRenderer mapRenderer = new MapRenderer(); mapRenderer.InitDocument(document, MapProjections[index]); diagramControl.UpdateView(); }
void INCustomRequestCallback.OnCustomRequestCallback(NAspNetThinWebControl control, NRequestContext context, string argument) { NThinDiagramControl diagramControl = (NThinDiagramControl)control; NNodeList decorators = diagramControl.Document.ActiveLayer.Descendants(ShowHideSubtreeDecoratorFilter, -1); int i, count = decorators.Count; string[] data = argument.Split('='); string name = data[0]; string value = data[1]; switch (name) { case "background": ToggleDecoratorBackgroundShape background = (ToggleDecoratorBackgroundShape)Enum.Parse(typeof(ToggleDecoratorBackgroundShape), value); for (i = 0; i < count; i++) { ((NToggleDecorator)decorators[i]).Background.Shape = background; } break; case "symbol": ToggleDecoratorSymbolShape symbol = (ToggleDecoratorSymbolShape)Enum.Parse(typeof(ToggleDecoratorSymbolShape), value); for (i = 0; i < count; i++) { ((NToggleDecorator)decorators[i]).Symbol.Shape = symbol; } break; case "position": NContentAlignment alignment; NSizeF offset; if (value == "Left") { alignment = new NContentAlignment(ContentAlignment.TopLeft); offset = new NSizeF(11, 11); } else { alignment = new NContentAlignment(ContentAlignment.TopRight); offset = new NSizeF(-11, 11); } for (i = 0; i < count; i++) { NToggleDecorator decorator = (NToggleDecorator)decorators[i]; decorator.Alignment = alignment; decorator.Offset = offset; } break; } control.UpdateView(); }