void INCustomRequestCallback.OnCustomRequestCallback(NAspNetThinWebControl control, NRequestContext context, string argument)
            {
                NThinDiagramControl diagramControl = (NThinDiagramControl)control;

                InitDocument(diagramControl.Document, Type.GetType(argument));
                control.UpdateView();
            }
            void INAutoUpdateCallback.OnAutoUpdate(NAspNetThinWebControl control)
            {
                NThinChartControl chartControl = (NThinChartControl)control;
                NBarSeries        bar          = (NBarSeries)chartControl.Charts[0].Series[0];

                int index = (int)chartControl.CustomData;

                for (int i = 0; i < bar.FillStyles.Count; i++)
                {
                    NColorFillStyle colorFill = bar.FillStyles[i] as NColorFillStyle;
                    if (i != index)
                    {
                        colorFill.Color = Color.FromArgb(60, colorFill.Color);
                    }
                    else
                    {
                        colorFill.Color = Color.FromArgb(255, colorFill.Color);
                    }
                }

                index++;

                if (index >= bar.FillStyles.Count)
                {
                    index = 0;
                }

                chartControl.CustomData = index;

                chartControl.UpdateView();
            }
            public void OnAutoUpdate(NAspNetThinWebControl control)
            {
                NThinChartControl chartControl = (NThinChartControl)control;
                NLineSeries       line         = (NLineSeries)chartControl.Charts[0].Series[0];

                if (line == null)
                {
                    return;
                }

                if (line.Values.Count == 0)
                {
                    return;
                }

                double dPrev = (double)line.Values[line.Values.Count - 1];

                double yValue = GenerateDataPoint(dPrev, new NRange1DD(50, 350));

                line.Values.RemoveAt(0);
                line.XValues.RemoveAt(0);

                line.Values.Add(yValue);
                line.XValues.Add(DateTime.Now.ToOADate());

                chartControl.UpdateView();
            }
            void INMouseEventCallback.OnMouseEvent(NAspNetThinWebControl control, NBrowserMouseEventArgs e)
            {
                NThinDiagramControl diagramControl = (NThinDiagramControl)control;
                NNodeList           nodes          = diagramControl.HitTest(new NPointF(e.X, e.Y));
                NNodeList           shapes         = nodes.Filter(TableShapeFilter);

                if (shapes.Count == 0)
                {
                    diagramControl.Document.Tag = null;
                    return;
                }

                NNodeList decorators = nodes.Filter(DecoratorFilter);

                if (decorators.Count > 0)
                {
                    // Toggle the clicked show/hide subtree decorator and update the view
                    ((NShowHideSubtreeDecorator)decorators[0]).ToggleState();
                    diagramControl.UpdateView();
                }

                // Send a custom command
                NTableShape table    = (NTableShape)shapes[0];
                NEmployee   employee = (NEmployee)table.Tag;

                diagramControl.AddCustomClientCommand(employee.GetData());
            }
Esempio n. 5
0
            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));
            }
Esempio n. 6
0
            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();
            }
Esempio n. 7
0
            public void OnMouseEvent(NAspNetThinWebControl control, NBrowserMouseEventArgs e)
            {
                NThinChartControl chartControl = (NThinChartControl)control;

                NPieChart      pieChart      = (NPieChart)chartControl.Charts[0];
                NHitTestResult hitTestResult = chartControl.HitTest(e.X, e.Y);

                int dataPointIndex = hitTestResult.DataPointIndex;

                // collapse all pie slices
                NPieSeries pieSeries = (NPieSeries)pieChart.Series[0];

                for (int i = 0; i < pieSeries.Values.Count; i++)
                {
                    pieSeries.Detachments[i] = 0;
                }

                // expand the one that's hit
                if (dataPointIndex != -1)
                {
                    pieSeries.Detachments[dataPointIndex] = 5.0f;
                }

                chartControl.UpdateView();
            }
Esempio n. 8
0
            void INAutoUpdateCallback.OnAutoUpdate(NAspNetThinWebControl control)
            {
                NThinDiagramControl diagramControl = (NThinDiagramControl)control;

                NDrawingDocument document = diagramControl.Document;

                NEllipseShape rotatingEllipse = document.ActiveLayer.GetChildByName("RotatingEllipse", 0) as NEllipseShape;

                if (rotatingEllipse == null)
                {
                    return;
                }

                NEllipseShape rotatingEllipse2 = document.ActiveLayer.GetChildByName("RotatingEllipse2", 0) as NEllipseShape;

                if (rotatingEllipse2 == null)
                {
                    return;
                }

                rotatingEllipse.Rotate(CoordinateSystem.Scene, 7, rotatingEllipse.PinPoint);
                rotatingEllipse2.Rotate(CoordinateSystem.Scene, -4, rotatingEllipse2.PinPoint);

                diagramControl.UpdateView();
            }
            void INMouseEventCallback.OnMouseEvent(NAspNetThinWebControl control, NBrowserMouseEventArgs e)
            {
                NThinDiagramControl diagramControl = (NThinDiagramControl)control;
                NNodeList           nodes          = diagramControl.HitTest(new NPointF(e.X, e.Y));
                NNodeList           shapes         = nodes.Filter(CellFilter);

                if (shapes.Count == 0)
                {
                    return;
                }

                NClickomaniaGame game = (NClickomaniaGame)diagramControl.Document.Tag;
                NTableCell       cell = (NTableCell)shapes[0];

                if (cell.ParentNode.ParentNode != game.BoardShape)
                {
                    return;
                }

                if (String.IsNullOrEmpty(cell.StyleSheetName))
                {
                    return;
                }

                if (game.OnCellClicked(cell) == false)
                {
                    return;
                }

                // The user has clicked on a cell that is part of a region
                diagramControl.ServerSettings.EnableAutoUpdate = true;
                diagramControl.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);

                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;
                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)
            {
                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)
            {
                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();
            }
Esempio n. 15
0
            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 INAutoUpdateCallback.OnAutoUpdate(NAspNetThinWebControl control)
            {
                NThinDiagramControl diagramControl = (NThinDiagramControl)control;
                NClickomaniaGame    game           = (NClickomaniaGame)diagramControl.Document.Tag;

                game.ClearHighlightedCells();

                diagramControl.ServerSettings.EnableAutoUpdate = false;
                diagramControl.Update();
            }
Esempio n. 17
0
            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();
            }
Esempio n. 18
0
            void INMouseEventCallback.OnMouseEvent(NAspNetThinWebControl control, NBrowserMouseEventArgs e)
            {
                NThinDiagramControl diagramControl = (NThinDiagramControl)control;
                NNodeList           nodes          = diagramControl.HitTest(new NPointF(e.X, e.Y));
                NNodeList           decorators     = nodes.Filter(ExpandCollapseDecoratorFilter);

                if (decorators.Count > 0)
                {
                    ((NExpandCollapseDecorator)decorators[0]).ToggleState();
                    diagramControl.UpdateView();
                }
            }
            void INMouseEventCallback.OnMouseEvent(NAspNetThinWebControl control, NBrowserMouseEventArgs e)
            {
                NThinDiagramControl diagramControl = (NThinDiagramControl)control;
                NNodeList           allShapes      = diagramControl.Document.ActiveLayer.Children(Nevron.Diagram.Filters.NFilters.Shape2D);

                NNodeList affectedNodes  = diagramControl.HitTest(new NPointF(e.X, e.Y));
                NNodeList affectedShapes = affectedNodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D);

                int  length;
                bool fillChanged = false;

                length = allShapes.Count;
                for (int i = 0; i < length; i++)
                {
                    NShape shape = allShapes[i] as NShape;
                    shape.Style.ShadowStyle = null;
                    if (shape.Tag != null)
                    {
                        NColorFillStyle newFill = new NColorFillStyle((Color)shape.Tag);
                        fillChanged           = fillChanged || !shape.Style.FillStyle.Equals(newFill);
                        shape.Style.FillStyle = newFill;
                    }
                }

                length = affectedShapes.Count;
                for (int i = 0; i < length; i++)
                {
                    NShape shape = affectedShapes[i] as NShape;
                    shape.Style.ShadowStyle = new NShadowStyle(ShadowType.GaussianBlur, Color.FromArgb(96, Color.Black), new NPointL(3, 3), 1, new NLength(10));

                    NColorFillStyle fs = shape.Style.FillStyle as NColorFillStyle;
                    if (fs != null && fs.Color != Color.White)
                    {
                        shape.Tag = fs.Color;
                        NColorFillStyle newFill = new NColorFillStyle(Color.YellowGreen);
                        fillChanged = fillChanged || !shape.Style.FillStyle.Equals(newFill);

                        shape.Style.FillStyle = newFill;
                    }
                }

                if (fillChanged)
                {
                    diagramControl.UpdateView();
                }
                else
                {
                    diagramControl.ClearResponse();
                }
            }
            void INMouseEventCallback.OnMouseEvent(NAspNetThinWebControl control, NBrowserMouseEventArgs e)
            {
                NThinChartControl chartControl = (NThinChartControl)control;

                NPieChart  pieChart  = (NPieChart)chartControl.Charts[0];
                NPieSeries pieSeries = (NPieSeries)pieChart.Series[0];

                for (int i = 0; i < pieSeries.Values.Count; i++)
                {
                    pieSeries.Detachments[i] = 5.0f;
                }

                chartControl.UpdateView();
            }
Esempio n. 21
0
            void INMouseEventCallback.OnMouseEvent(NAspNetThinWebControl control, NBrowserMouseEventArgs e)
            {
                NThinDiagramControl diagramControl = (NThinDiagramControl)control;
                NNodeList           nodes          = diagramControl.HitTest(new NPointF(e.X, e.Y));
                NNodeList           shapes         = nodes.Filter(NFilters.Shape2D);
                NDrawingDocument    document       = diagramControl.Document;

                if (String.IsNullOrEmpty(m_MapRenderer.CurrentState))
                {
                    if (shapes.Count == 0)
                    {
                        return;
                    }

                    // The user has clicked a state
                    NShape shape = (NShape)shapes[0];
                    m_MapRenderer.LoadStateMap(document, shape.Name);
                }
                else
                {
                    if (shapes.Count == 0)
                    {
                        // Return to the States map
                        m_MapRenderer.LoadUsaMap(document);
                    }
                    else
                    {
                        // The user has clicked a county
                        NShape shape = (NShape)shapes[0];
                        if (shape.StyleSheetName == "ClickedCounty")
                        {
                            // The user has clicked a selected county - unselect it
                            shape.StyleSheetName = String.Empty;
                            shape.Text           = String.Empty;
                        }
                        else
                        {
                            // The user has clicked a non selected county - select it (make it red)
                            shape.StyleSheetName = "ClickedCounty";
                            shape.Text           = shape.Name;
                        }
                    }
                }

                diagramControl.UpdateView();
            }
            void INAutoUpdateCallback.OnAutoUpdateStateChanged(NAspNetThinWebControl control)
            {
                // reset colors
                NThinChartControl chartControl = (NThinChartControl)control;
                NBarSeries        bar          = (NBarSeries)chartControl.Charts[0].Series[0];

                int index = (int)chartControl.CustomData;

                for (int i = 0; i < bar.FillStyles.Count; i++)
                {
                    NColorFillStyle colorFill = bar.FillStyles[i] as NColorFillStyle;
                    colorFill.Color = Color.FromArgb(255, colorFill.Color);
                }

                chartControl.CustomData = 0;
                chartControl.UpdateView();
            }
Esempio n. 23
0
 void INAutoUpdateCallback.OnAutoUpdateStateChanged(NAspNetThinWebControl control)
 {
     throw new NotImplementedException();
 }
 void INAutoUpdateCallback.OnAutoUpdateStateChanged(NAspNetThinWebControl control)
 {
 }
 public void OnAutoUpdateStateChanged(NAspNetThinWebControl control)
 {
 }