Exemple #1
0
        public Palette CreateConnectors()
        {
            Palette Palette = new Palette("Connectors");

            Palette.Expanded = true; Palette.TemplateId = "svgTemplate";
            Palette.AddInfo  = new Dictionary <string, object>();
            (Palette.AddInfo as Dictionary <string, object>).Add("source", Url.Content("~/Content/diagram/images/connector.png"));
            Collection Segments = new Collection();

            Segments.Add(new Segment()
            {
                Type = Syncfusion.JavaScript.DataVisualization.DiagramEnums.Segments.Orthogonal
            });
            PaletteItem PaletteItem = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.PaletteItem()
            {
                Height = 45, Width = 57, EnableScale = false
            };

            Palette.Items.Add(new Connector()
            {
                Name = "Link1", Segments = Segments, SourcePoint = new DiagramPoint()
                {
                    X = 0, Y = 0
                }, TargetPoint = new DiagramPoint()
                {
                    X = 40, Y = 40
                }, PaletteItem = PaletteItem, TargetDecorator = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Decorator()
                {
                    Shape = DecoratorShapes.Arrow
                }
            });
            Palette.Items.Add(new Connector()
            {
                Name = "Link2", Segments = Segments, SourcePoint = new DiagramPoint()
                {
                    X = 0, Y = 0
                }, TargetPoint = new DiagramPoint()
                {
                    X = 40, Y = 40
                }, PaletteItem = PaletteItem, TargetDecorator = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Decorator()
                {
                    Shape = DecoratorShapes.None
                }
            });
            Segments = new Collection();
            Segments.Add(new Segment()
            {
                Type = Syncfusion.JavaScript.DataVisualization.DiagramEnums.Segments.Straight
            });
            Palette.Items.Add(new Connector()
            {
                Name = "Link1", Segments = Segments, SourcePoint = new DiagramPoint()
                {
                    X = 0, Y = 0
                }, TargetPoint = new DiagramPoint()
                {
                    X = 40, Y = 40
                }, PaletteItem = PaletteItem, TargetDecorator = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Decorator()
                {
                    Shape = DecoratorShapes.Arrow
                }
            });
            Palette.Items.Add(new Connector()
            {
                Name = "Link2", Segments = Segments, SourcePoint = new DiagramPoint()
                {
                    X = 0, Y = 0
                }, TargetPoint = new DiagramPoint()
                {
                    X = 40, Y = 40
                }, PaletteItem = PaletteItem, TargetDecorator = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Decorator()
                {
                    Shape = DecoratorShapes.None
                }
            });
            return(Palette);
        }
Exemple #2
0
        public Palette CreateBasicShapes()
        {
            Palette Palette = new Palette("Basic Shapes");

            Palette.Expanded = true; Palette.TemplateId = "svgTemplate";
            Palette.AddInfo  = new Dictionary <string, object>();
            (Palette.AddInfo as Dictionary <string, object>).Add("source", Url.Content("~/Content/diagram/images/basic.png"));
            PaletteItem PaletteItem = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.PaletteItem()
            {
                Margin = new Margin()
                {
                    Left = 4, Right = 4, Top = 12, Bottom = 10
                }, EnableScale = false
            };

            Palette.Items.Add(new BasicShape()
            {
                Name = "Rectangle1", Height = 160, Width = 80, Shape = BasicShapes.Rectangle, PaletteItem = PaletteItem
            });
            Palette.Items.Add(new BasicShape()
            {
                Name = "Rectangle2", Height = 70, Width = 70, Shape = BasicShapes.Rectangle
            });
            Palette.Items.Add(new BasicShape()
            {
                Name = "Ellipse", Height = 70, Width = 70, Shape = BasicShapes.Ellipse
            });
            Collection Collection = new Syncfusion.JavaScript.DataVisualization.Models.Collections.Collection();

            Collection.Add(new DiagramPoint()
            {
                X = 25, Y = 0
            });
            Collection.Add(new DiagramPoint()
            {
                X = 75, Y = 0
            });
            Collection.Add(new DiagramPoint()
            {
                X = 100, Y = 50
            });
            Collection.Add(new DiagramPoint()
            {
                X = 75, Y = 100
            });
            Collection.Add(new DiagramPoint()
            {
                X = 25, Y = 100
            });
            Collection.Add(new DiagramPoint()
            {
                X = 0, Y = 50
            });
            Palette.Items.Add(new BasicShape()
            {
                Name = "Hexagon", Height = 70, Width = 70, Shape = BasicShapes.Polygon, Points = Collection
            });
            Collection = new Syncfusion.JavaScript.DataVisualization.Models.Collections.Collection();
            Collection.Add(new DiagramPoint()
            {
                X = 50, Y = 0
            });
            Collection.Add(new DiagramPoint()
            {
                X = 100, Y = 100
            });
            Collection.Add(new DiagramPoint()
            {
                X = 0, Y = 100
            });
            Palette.Items.Add(new BasicShape()
            {
                Name = "Triangle", Height = 70, Width = 70, Shape = BasicShapes.Polygon, Points = Collection
            });
            return(Palette);
        }