Пример #1
0
        private void AdjustLegendControls()
        {
            try
            {
                this.suppressChanges = true;

                ElementPosition position = Chart1.Legends[0].Position;

                if (position.X > 47)
                {
                    position.Width = 60;
                }

                if (position.Y > 91)
                {
                    position.Height = 9;
                }

                XEdit.Value      = (decimal)position.X;
                YEdit.Value      = (decimal)position.Y;
                WidthEdit.Value  = (decimal)position.Width;
                HeightEdit.Value = (decimal)position.Height;
            }
            finally
            {
                this.suppressChanges = false;
            }
        }
Пример #2
0
        private ElementPosition AdjustFitWithinBounds(Rectangle element, Rectangle target, Rectangle bounding, PositionDirectionalHintData positionData, double gap = 0)
        {
            var             alignmentEdge   = positionData.AlignmentEdge;
            var             alignTargetEdge = positionData.AlignTargetEdge;
            ElementPosition elementEstimate = new ElementPosition(element, positionData.TargetEdge, alignmentEdge);

            if (!DirectionalHintFixed && !CoverTarget)
            {
                elementEstimate = FlipToFit(element, target, bounding, positionData, gap);
            }
            var outOfBounds = GetOutOfBoundsEdges(element, bounding);

            if (alignTargetEdge)
            {
                // The edge opposite to the alignment edge might be out of bounds. Flip alignment to see if we can get it within bounds.
                if (elementEstimate.AlignmentEdge != RectangleEdge.None && outOfBounds.IndexOf((RectangleEdge)((int)elementEstimate.AlignmentEdge * -1)) > -1)
                {
                    var flippedElementEstimate = FlipAlignmentEdge(elementEstimate, target, gap);
                    if (IsRectangleWithinBounds(flippedElementEstimate.ElementRectangle, bounding))
                    {
                        return(flippedElementEstimate);
                    }
                }
            }
            else
            {
                foreach (var direction in outOfBounds)
                {
                    elementEstimate.ElementRectangle = AlignEdges(elementEstimate.ElementRectangle, bounding, direction);
                }
            }
            return(elementEstimate);
        }
Пример #3
0
        /// <summary>
        /// Set state of an element to Finish
        /// </summary>
        /// <param name="object"></param>
        private void setFinish(object o)
        {
            if (solutionMode)
            {
                ExitSolutionMode();
            }
            Label label = (Label)o;

            if (maze.SetFinishPosition(getLabelPosition(label.Name)))
            {
                if (finishPos != null)
                {
                    getLabel(finishPos).Background = new SolidColorBrush(colorScheme.MazeBackgroundColor);
                    getLabel(finishPos).Content    = null;
                }
                startPos  = maze.StartPos;
                finishPos = maze.FinishPos;
                if (finishPos != null)
                {
                    label.Background = new SolidColorBrush(colorScheme.FinishPositionColor);
                }
                else
                {
                    label.Background = new SolidColorBrush(colorScheme.MazeBackgroundColor);
                }
            }
        }
Пример #4
0
 public static CaretVector From(SourcePoint target, SourcePoint source, ElementPosition position)
 {
     CaretVector caretVector = new CaretVector(position);
     caretVector.LineDelta = target.Line - source.Line;
     caretVector.OffsetDelta = target.Offset - source.Offset;
     return caretVector;
 }
Пример #5
0
 /// <summary>
 /// Updates the whole visual maze
 /// </summary>
 private void updateMazeGrid()
 {
     if (maze != null)
     {
         for (byte i = 0; i < maze.Height; i++)
         {
             for (byte j = 0; j < maze.Width; j++)
             {
                 // Check whether an Element is block or empty
                 getLabel(i, j).Background = (maze.Map[i, j].Status == ElementStatus.BLOCK) ? new SolidColorBrush(colorScheme.BlockColor) : new SolidColorBrush(colorScheme.MazeBackgroundColor);
             }
         }
         // Update start and finish positions values
         startPos  = maze.StartPos;
         finishPos = maze.FinishPos;
         // Display new start and positions
         if (startPos != null)
         {
             getLabel(startPos).Background = new SolidColorBrush(colorScheme.StartPositionColor);
         }
         if (finishPos != null)
         {
             getLabel(finishPos).Background = new SolidColorBrush(colorScheme.FinishPositionColor);
         }
     }
 }
Пример #6
0
 protected override void SetElementOrder()
 {
     AddElementOrder(
         new ElementPosition("JournalEntryAdd",
                             "TxnDate",
                             "RefNumber",
                             "IsAdjustment",
                             new ElementPosition("JournalDebitLine",
                                                 "TxnLineID",
                                                 ElementPosition.Ref("AccountRef"),
                                                 "Amount",
                                                 "Memo",
                                                 ElementPosition.Ref("EntityRef"),
                                                 ElementPosition.Ref("ClassRef"),
                                                 "BillableStatus"),
                             new ElementPosition("JournalCreditLine",
                                                 "TxnLineID",
                                                 ElementPosition.Ref("AccountRef"),
                                                 "Amount",
                                                 "Memo",
                                                 ElementPosition.Ref("EntityRef"),
                                                 ElementPosition.Ref("ClassRef"),
                                                 "BillableStatus"),
                             "IncludeRetElement"));
 }
Пример #7
0
    public void GenerateListElement()
    {
        showText.text = "1234";


        for (int i = 0; i < elementParent.childCount; i++)
        {
            currentPosition = GetElementPosition(elementParent.GetChild(i).position);
            Debug.LogError(elementParent.GetChild(i).position);
            if (LayoutGroups.ContainsKey(currentPosition.xPos))
            {
                LayoutGroups[currentPosition.xPos].Add(new LayoutElementPosY
                {
                    PosY      = currentPosition.yPos,
                    ElementNo = elementParent.GetChild(i).GetComponent <ElementInfor>().GetBlockID()
                });
            }
            else
            {
                LayoutGroups.Add(currentPosition.xPos, new List <LayoutElementPosY>()
                {
                    new LayoutElementPosY
                    {
                        PosY      = currentPosition.yPos,
                        ElementNo = elementParent.GetChild(i).GetComponent <ElementInfor>().GetBlockID()
                    }
                });
            }
        }
        layoutData.LayoutGroups = LayoutGroups;
        WriteJsonLayoutData();
    }
Пример #8
0
        private void addHistogram(Bitmap image, string seriesName)
        {
            var values = ImageUtils.getCumulativeHistogram(image);

            //todo: remove
            values[255] = 0;
            values[254] = 0;
            iHistogramChart.ChartAreas.Add(seriesName);
            iHistogramChart.ChartAreas[seriesName].Position.Height = 80;
            iHistogramChart.Width = 600 * (imageListPaths.Count + 1);
            iHistogramChart.ChartAreas[seriesName].Position.X     = 100.0F / (imageListPaths.Count + 1) * (iHistogramChart.ChartAreas.Count - 1);
            iHistogramChart.ChartAreas[seriesName].Position.Width = (100.0F / (imageListPaths.Count + 1));
            iHistogramChart.Series.Add(seriesName);
            iHistogramChart.Legends.Add(new Legend(seriesName));
            iHistogramChart.Legends[seriesName].DockedToChartArea       = seriesName;
            iHistogramChart.Legends[seriesName].IsDockedInsideChartArea = false;
            iHistogramChart.Legends[seriesName].Docking  = Docking.Bottom;
            iHistogramChart.Series[seriesName].Legend    = seriesName;
            iHistogramChart.Series[seriesName].ChartType = SeriesChartType.Column;
            iHistogramChart.Series[seriesName].Points.DataBindY(values);
            iHistogramChart.Series[seriesName].ChartArea = seriesName;
            var plotPosition = new ElementPosition();

            plotPosition.X      = 0;
            plotPosition.Y      = 0;
            plotPosition.Width  = 70;
            plotPosition.Height = 80;
            iHistogramChart.ChartAreas[seriesName].InnerPlotPosition = plotPosition;
            iHistogramChart.Series[seriesName].XValueType            = ChartValueType.UInt64;
        }
Пример #9
0
        /// <summary>
        /// Set the X-axis with a specific type of ChartAxis.
        /// If successful, assigns the Axis type (x,y) and label position to the axis.
        /// </summary>
        /// <param name="labelPosition"></param>
        /// <param name="axis"></param>
        /// <param name="axisWidth"></param>
        /// <param name="axisLabelAngle"></param>
        public void SetXAxis(ElementPosition labelPosition, AbstractScaleAxis <TXAxisDataType> axis, AxisWidth axisWidth, int axisLabelAngle = 0)
        {
            if ((axisLabelAngle != 0) && (axisLabelAngle != 90))
            {
                throw new ArgumentException("AxisLabelAngle can only be 0 or 90.");
            }

            // Will throw an ArgumentException if it doesn't work.
            ValidateAxis(Axis.X, labelPosition);

            // Apply the requested value
            axis.AxisXY       = Axis.X;
            axis.AxisPosition = labelPosition;
            axis.AxisWidth    = axisWidth;
            axis.LabelAngle   = axisLabelAngle;
            _xAxis1           = axis;

            // If BOTH the Minimum or Maximum haven't been set, then auto-calculate values.
            if (EqualityComparer <TXAxisDataType> .Default.Equals(axis.MinimumValue, default) &&
                EqualityComparer <TXAxisDataType> .Default.Equals(axis.MaximumValue, default))
            {
                (TXAxisDataType Min, TXAxisDataType Max) = GetXAxisBounds();
                axis.MinimumValue = Min;
                axis.MaximumValue = Max;
            }
            Console.WriteLine($"For X axis min is {axis.MinimumValue} and max is {axis.MaximumValue}");

            axis.InitialAxisPreparation();
        }
Пример #10
0
        public void Constructor_with_ElementPosition_array_children()
        {
            var element = new ElementPosition("ParentRef", new ElementPosition("ListID"), new ElementPosition("FullName"));

            Assert.AreEqual(2, element.ChildrenOrder.Count, "Count");
            Assert.AreEqual("ListID", element.ChildrenOrder[0].Name);
        }
Пример #11
0
 public RelativeToPositioner(ElementPosition anchor, float xPortionAnchor, float yPortionAnchor, float xPortionThis, float yPortionThis)
 {
     this.anchor         = anchor;
     this.xPortionAnchor = xPortionAnchor;
     this.yPortionAnchor = yPortionAnchor;
     this.xPortionThis   = xPortionThis;
     this.yPortionThis   = yPortionThis;
 }
Пример #12
0
        public static void SetupChart(Chart chart)
        {
            ChartArea area   = chart.ChartAreas[0];
            Legend    legend = chart.Legends[0];
            Title     title  = chart.Titles[0];

            area.AxisX.RoundAxisValues();

            area.AxisX.ScaleView.Zoomable = true;
            area.AxisY.ScaleView.Zoomable = true;

            area.AxisY.ScaleView.MinSize         = 0.01;
            area.AxisY.ScaleView.SmallScrollSize = 0.001;

            area.AxisX.LabelStyle.Format = "0.##";
            area.AxisY.LabelStyle.Format = "0.##";

            area.CursorY.Interval = 0.001;

            area.CursorX.AutoScroll = true;
            area.CursorY.AutoScroll = true;

            area.CursorX.IsUserSelectionEnabled = true;
            area.CursorY.IsUserSelectionEnabled = true;

            area.CursorX.IsUserEnabled = true;
            area.CursorY.IsUserEnabled = true;

            chart.Series[1].Points.Clear();
            chart.Series[1].Points.AddXY(0, 0);

            area.AxisX.TitleFont = new System.Drawing.Font(area.AxisX.TitleFont.Name, Constants.ChartAxisFontSize, System.Drawing.FontStyle.Bold);
            area.AxisY.TitleFont = area.AxisX.TitleFont;

            title.Font = new System.Drawing.Font(title.Font.Name, Constants.ChartTitleFontSize, System.Drawing.FontStyle.Italic | System.Drawing.FontStyle.Bold);

            chart.Series[0].BorderWidth = Constants.ChartSeriesLineWidth;
            chart.Series[0].MarkerSize  = Constants.ChartSeriesLineWidth * 2;
            chart.Series[2].BorderWidth = Constants.ChartSeriesLineWidth;
            chart.Series[2].MarkerSize  = Constants.ChartSeriesLineWidth * 2;

            area.AxisX.MinorGrid.Enabled       = true;
            area.AxisX.MinorGrid.LineDashStyle = ChartDashStyle.Dot;

            title.Alignment = System.Drawing.ContentAlignment.MiddleCenter;

            legend.DockedToChartArea = area.Name;
            legend.LegendStyle       = LegendStyle.Row;

            ElementPosition legendPosNew = new ElementPosition(25, 0, 50, 25);

            legend.Position = legendPosNew;

            System.Drawing.Color bgTrans = System.Drawing.Color.Transparent;

            area.BackColor   = bgTrans;
            legend.BackColor = bgTrans;
        }
Пример #13
0
        public SyntaxToken(SyntaxKind kind, string text, ElementPosition position, object value)
        {
            Kind     = kind;
            Position = position;
            Text     = text ?? string.Empty;
#pragma warning disable CS8601 // Возможно, назначение-ссылка, допускающее значение NULL.
            Value = value;
#pragma warning restore CS8601 // Возможно, назначение-ссылка, допускающее значение NULL.
        }
Пример #14
0
            public StretchToPositioner(ElementPosition anchor, Vector2 anchorPortion, Vector2 oppositePortion, Vector2 marginFilter)
            {
                this.anchor          = anchor;
                this.anchorPortion   = anchorPortion;
                this.oppositePortion = oppositePortion;
                this.marginFilter    = marginFilter;

                this.strechAxis    = abs(oppositePortion);
                this.preservedAxis = abs(this.strechAxis.PerpendicularLeft);
            }
Пример #15
0
        private ElementPosition FlipAlignmentEdge(ElementPosition elementEstimate, Rectangle target, double gap)
        {
            var alignmentEdge    = elementEstimate.AlignmentEdge;
            var targetEdge       = elementEstimate.TargetEdge;
            var elementRectangle = elementEstimate.ElementRectangle;
            var oppositeEdge     = (RectangleEdge)((int)alignmentEdge * -1);
            var newEstimate      = EstimatePosition(elementRectangle, target, new PositionDirectionalHintData(targetEdge, oppositeEdge), gap);

            return(new ElementPosition(newEstimate, targetEdge, oppositeEdge));
        }
Пример #16
0
            public void Recalculate(ElementPosition element, ElementPosition parentPosition)
            {
                float marginX = hasMargins ? element.marginX : 0;
                float marginY = hasMargins ? element.marginY : 0;

                element.Center = new Vector2(
                    this.anchor.Center.X + (this.anchor.Size.X + marginX) * this.xPortionAnchor / 2 - element.Size.X * this.xPortionThis / 2,
                    this.anchor.Center.Y + (this.anchor.Size.Y + marginY) * this.yPortionAnchor / 2 - element.Size.Y * this.yPortionThis / 2
                    );
            }
Пример #17
0
 //------------------------------------------------------
 private void AppliquePosition(CChartElementPosition f, ElementPosition ms)
 {
     ms.Auto = f.Auto;
     if (!f.Auto)
     {
         ms.X      = f.X;
         ms.Y      = f.Y;
         ms.Width  = f.Width;
         ms.Height = f.Height;
     }
 }
Пример #18
0
 /// <summary>
 /// Check if an aray contains a specific element
 /// </summary>
 /// <param name="array"></param>
 /// <param name="pos"></param>
 /// <returns></returns>
 private bool contains(ElementPosition[] array, ElementPosition pos)
 {
     foreach (ElementPosition item in array)
     {
         if (item == pos)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #19
0
 public bool IsNextTo(ElementPosition ElementPosition)
 {
     if (ElementPosition.Col >= Col - 1 &&
         ElementPosition.Col <= Col + 1 &&
         ElementPosition.Row >= Row - 1 &&
         ElementPosition.Row <= Row + 1)
     {
         return(true);
     }
     return(false);
 }
Пример #20
0
 /// <summary>
 /// Clears data related to the current maze
 /// </summary>
 private void disposeMaze()
 {
     if (maze != null)
     {
         hideMaze();
         mazeGrid.Children.Clear();
         gridsCanvas.Children.Clear();
         maze      = null;
         startPos  = null;
         finishPos = null;
     }
 }
Пример #21
0
            public void Recalculate(ElementPosition element, ElementPosition parentPosition)
            {
                float marginX = hasMargins ? element.marginX : 0;
                float marginY = hasMargins ? element.marginY : 0;
                float windowX = parentPosition.Size.X / 2 - marginX - element.Size.X / 2;
                float windowY = parentPosition.Size.Y / 2 - marginY - element.Size.Y / 2;

                element.Center = new Vector2(
                    windowX * this.xPortion + parentPosition.Center.X,
                    windowY * this.yPortion + parentPosition.Center.Y
                    );
            }
Пример #22
0
 protected override void SetElementOrder()
 {
     AddElementOrder(
         new ElementPosition("EmployeeMod",
                             "ListID",
                             "EditSequence",
                             "IsActive",
                             "Salutation",
                             "FirstName",
                             "MiddleName",
                             "LastName",
                             "JobTitle",
                             "Department",
                             "Description",
                             new ElementPosition("EmployeeAddress",
                                                 "Addr1",
                                                 "Addr2",
                                                 "City",
                                                 "State",
                                                 "PostalCode",
                                                 "Country"),
                             "PrintAs",
                             "Phone",
                             "Mobile",
                             "Pager",
                             "PagerPIN",
                             "AltPhone",
                             "Fax",
                             "SSN",
                             "Email",
                             ElementPosition.Ref("AdditionalContactRef"),
                             "EmployeeType",
                             "PartOrFullTime",
                             "Exempt",
                             "KeyEmployee",
                             "Gender",
                             "HiredDate",
                             "OriginalHireDate",
                             "AdjustedServiceDate",
                             "ReleasedDate",
                             "BirthDate",
                             "USCitizen",
                             "Ethnicity",
                             "Disabled",
                             "DisabilityDesc",
                             "OnFile",
                             "WorkAuthExpireDate",
                             "USVeteran",
                             "MilitaryStatus",
                             "AccountNumber",
                             "Notes",
                             "IncludeRetElement"));
 }
Пример #23
0
            public void Recalculate(ElementPosition element, ElementPosition parentPosition)
            {
                var margin      = this.marginFilter * new Vector2(element.marginX, element.marginY);
                var oppositeEnd = element.Center + element.Size * this.oppositePortion / 2;
                var anchorEnd   = this.anchor.Center + this.anchorPortion * this.anchor.Size / 2;

                var marginSign = Vector2.Dot(anchorEnd - element.Center, this.strechAxis) > 0 ? -1 : 1;

                anchorEnd += margin * marginSign;

                element.Center = element.Center * this.preservedAxis + (oppositeEnd + anchorEnd) * this.strechAxis / 2;
                element.Size   = element.Size * this.preservedAxis + abs(oppositeEnd - anchorEnd) * this.strechAxis;
            }
Пример #24
0
        private CalloutBeakPositionedInfo FinalizeBeakPosition(ElementPosition elementPosition, Rectangle positionedBeak, Rectangle bounds)
        {
            var targetEdge               = (RectangleEdge)((int)elementPosition.TargetEdge * -1);
            var actualElement            = new Rectangle(0, elementPosition.ElementRectangle.width, 0, elementPosition.ElementRectangle.height);
            PartialRectangle returnValue = new PartialRectangle();
            var returnEdge               = FinalizeReturnEdge(
                elementPosition.ElementRectangle,
                elementPosition.AlignmentEdge != RectangleEdge.None ? elementPosition.AlignmentEdge : GetFlankingEdges(targetEdge).positiveEdge,
                bounds);

            switch (targetEdge)
            {
            case RectangleEdge.Bottom:
                returnValue.bottom = GetEdgeValue(positionedBeak, targetEdge);
                break;

            case RectangleEdge.Left:
                returnValue.left = GetEdgeValue(positionedBeak, targetEdge);
                break;

            case RectangleEdge.Right:
                returnValue.right = GetEdgeValue(positionedBeak, targetEdge);
                break;

            case RectangleEdge.Top:
                returnValue.top = GetEdgeValue(positionedBeak, targetEdge);
                break;
            }
            switch (returnEdge)
            {
            case RectangleEdge.Bottom:
                returnValue.bottom = GetRelativeEdgeDifference(positionedBeak, actualElement, returnEdge);
                break;

            case RectangleEdge.Left:
                returnValue.left = GetRelativeEdgeDifference(positionedBeak, actualElement, returnEdge);
                break;

            case RectangleEdge.Right:
                returnValue.right = GetRelativeEdgeDifference(positionedBeak, actualElement, returnEdge);
                break;

            case RectangleEdge.Top:
                returnValue.top = GetRelativeEdgeDifference(positionedBeak, actualElement, returnEdge);
                break;
            }
            return(new CalloutBeakPositionedInfo(
                       returnValue,
                       GetClosestEdge(elementPosition.TargetEdge, positionedBeak, actualElement),
                       targetEdge));
        }
Пример #25
0
        private void Chart1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (e.X != 0 && e.Y != 0)
            {
                ElementPosition position = Chart1.Legends[0].Position;
                // Conver pixels to percentage coordinates and set legend position
                position.X = e.X * 100F / ((float)(Chart1.Size.Width - 1));
                position.Y = e.Y * 100F / ((float)(Chart1.Size.Height - 1));

                AdjustLegendControls();

                Chart1.Invalidate();
            }
        }
Пример #26
0
        public void Add(ElementPosition position)
        {
            if (this.row != 0 || this.column != 0)
            {
                position.Offset((this.ElementWidth + this.ElementSpacing) * this.column, -(this.ElementHeight + this.ElementSpacing) * this.row);
            }

            this.column++;
            if (column >= this.Columns)
            {
                this.column = 0;
                this.row++;
            }
        }
Пример #27
0
        /// <summary>
        /// Set state of an element to Block
        /// </summary>
        /// <param name="object"></param>
        private void setBlock(object o)
        {
            if (solutionMode)
            {
                ExitSolutionMode();
            }
            Label label = (Label)o;

            if (maze.AddBlock(getLabelPosition(label.Name)))
            {
                label.Background = new SolidColorBrush(colorScheme.BlockColor);
                startPos         = maze.StartPos;
                finishPos        = maze.FinishPos;
            }
        }
Пример #28
0
        public void SetLegenedPosition(LegendPossition position)
        {
            foreach (ToolStripMenuItem menuItem in legendPossitionToolStripMenuItem.DropDownItems)
            {
                menuItem.Checked = (LegendPossition)menuItem.Tag == position;
            }

            ChartArea legendArea = chart1.ChartAreas["ChartAreaLegend"];

            switch (position)
            {
            case LegendPossition.Left:
                legendArea.Position = new ElementPosition(0, 0, 9, 100);
                legendArea.Tag      = LegendPossition.Left;
                chartArea.Position  = new ElementPosition(10, 0, 90, 100);

                break;

            case LegendPossition.Right:
                legendArea.Position = new ElementPosition(91, 0, 9, 100);
                legendArea.Tag      = LegendPossition.Right;
                chartArea.Position  = new ElementPosition(0, 0, 90, 100);

                break;

            case LegendPossition.Top:
                legendArea.Position = new ElementPosition(0, 0, 100, 9);
                legendArea.Tag      = LegendPossition.Top;
                chartArea.Position  = new ElementPosition(0, 10, 100, 90);

                break;

            case LegendPossition.Bottom:
                legendArea.Position = new ElementPosition(0, 91, 100, 9);
                legendArea.Tag      = LegendPossition.Bottom;
                chartArea.Position  = new ElementPosition(0, 0, 100, 90);

                break;
            }

            foreach (Legend legend in chart1.Legends)
            {
                legend.Position = legendArea.Position;
            }

            legendToolStripMenuItem.Visible = true;
            lastPossition = chartArea.Position;
        }
Пример #29
0
        /// <summary>
        /// Validates the Axis.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="labelPosition"></param>
        public void ValidateAxis(Axis type, ElementPosition labelPosition)
        {
            // TODO redo

            /* int index = (int)type;
             *
             * if (axes[index] != null)
             *   throw new ArgumentException($"Axis {type} has already been set.");
             *
             * if ((axes[0] != null) && (axes[0].Format == AxisFormat.TIME_SCALE) && (axes[1] != null) && (axes[1].Format != AxisFormat.DATA_SERIES))
             *   throw new ArgumentException($"Axis types are conflicting. {axes[0].AxisXY} is {axes[0].Format} and {axes[1].AxisXY} is {axes[1].Format}.");
             *
             * if ((type == Axis.X) && ((labelPosition == ElementPosition.LEFT) || (labelPosition == ElementPosition.RIGHT))
             || (type == Axis.Y) && ((labelPosition == ElementPosition.TOP) || (labelPosition == ElementPosition.BOTTOM)))
             ||  throw new ArgumentException($"Axis label positions are not valid.");*/
        }
Пример #30
0
        public void AddUpdateMessage_parentXML_doesnt_add_message_if_last_value_is_null()
        {
            var qbxmlBase = new QBXMLBaseChild();
            var xml       = new XElement("ClassQueryRq");
            var order     = new ElementPosition("ClassQueryRq",
                                                "MaxReturned",
                                                "ListID");

            qbxmlBase.AddUpdateMessage(xml, order, "MaxReturned", null);
            qbxmlBase.AddUpdateMessage(xml, order, "ListID", 22);

            var expected = new XElement("ClassQueryRq",
                                        new XElement("ListID", "22"));

            AssertXmlAreEqual(expected, xml);
        }
Пример #31
0
        public PositionAdapter(Chart baseChart, EasyChartXPlotArea plotArea)
        {
            this._baseChart = baseChart;
            this._chartArea = plotArea;
            ChartArea chartArea = plotArea.ChartArea;

            this._chartSize    = new Size(_baseChart.Width, _baseChart.Height);
            this._areaPosition = new ElementPosition(chartArea.Position.X, chartArea.Position.Y,
                                                     chartArea.Position.Width, chartArea.Position.Height);
            this._plotPosition = new ElementPosition(chartArea.InnerPlotPosition.X, chartArea.InnerPlotPosition.Y,
                                                     chartArea.InnerPlotPosition.Width, chartArea.InnerPlotPosition.Height);
            this._maxX = chartArea.AxisX.ScaleView.ViewMaximum;
            this._minX = chartArea.AxisX.ScaleView.ViewMinimum;

            CalculatePointPosition();
        }
Пример #32
0
 /// <summary>
 /// Reads the next node from the stream.
 /// </summary>
 /// <returns>
 /// true if the next node was read successfully; false if there are no more nodes to read.
 /// </returns>
 /// <exception cref="T:System.Xml.XmlException">An error occurred while parsing the XML. </exception>
 public override bool Read()
 {
     switch (readState) {
     case ReadState.Initial:
         if (current != null) {
             readState = ReadState.Interactive;
             return true;
         }
         readState = ReadState.EndOfFile;
         return false;
     case ReadState.Interactive:
         MoveToElement();
         switch (elementPosition) {
         case ElementPosition.Start:
             if (IsTerminal) {
                 elementPosition = ElementPosition.Text;
                 return true;
             } else {
                 Reduction reduction = current as Reduction;
                 if (reduction != null) {
                     if (reduction.Children.Count > 0) {
                         stack.Push(new KeyValuePair<Token, int>(reduction, 0));
                         current = reduction.Children[0];
                         return true;
                     }
                 }
             }
             elementPosition = ElementPosition.End;
             return true;
         case ElementPosition.Text:
             elementPosition = ElementPosition.End;
             return true;
         case ElementPosition.End:
             if (stack.Count > 0) {
                 KeyValuePair<Token, int> pair = stack.Pop();
                 current = pair.Key;
                 Reduction reduction = (Reduction)current;
                 if (pair.Value < (reduction.Children.Count-1)) {
                     current = reduction.Children[pair.Value+1];
                     stack.Push(new KeyValuePair<Token, int>(pair.Key, pair.Value+1));
                     elementPosition = ElementPosition.Start;
                 }
                 return true;
             }
             readState = ReadState.EndOfFile;
             break;
         }
         break;
     }
     return false;
 }
Пример #33
0
 /// <summary>
 /// Represents an element of this intersection matrix
 /// </summary>
 /// <param name="x">Row number</param>
 /// <param name="y">Column number</param>
 /// <returns></returns>
 public ElementValue this[ElementPosition x, ElementPosition y]
 {
     get 
     {
         return _values[(int)x, (int)y];
     }
     set 
     {
         _values[(int)x, (int)y] = value;
     }
 }
Пример #34
0
 public CaretVector(ElementPosition position)
 {
     ElementPosition = position;
 }
Пример #35
0
 private ChartArea CreateChartArea(ElementPosition position)
 {
     return new ChartArea(chartAreaName)
     {
         Position = new ElementPosition(0, 0, 100, 100),
         InnerPlotPosition = position,
         AxisY =
         {
             LineColor = ColorTranslator.FromHtml(ChartColors.Gray),
             MajorGrid =
             {
                 LineColor = ColorTranslator.FromHtml(ChartColors.Gray)
             },
             MajorTickMark =
             {
                 LineColor = ColorTranslator.FromHtml(ChartColors.Gray),
                 Size = 1
             },
             Minimum = YMin,
             Maximum = YMax,
             Interval = AxisYInterval,
             LabelStyle =
             {
                 Enabled = true,
                 Format = AxisYLabelFormat,
                 Font = (Font)defaultFont.Clone()
             }
         },
         AxisX =
         {
             LineColor = ColorTranslator.FromHtml(ChartColors.Gray),
             Minimum = 0,
             Interval = 1,
             MajorGrid =
             {
                 LineColor = ColorTranslator.FromHtml(ChartColors.White)
             },
             MinorGrid =
             {
                 LineColor = ColorTranslator.FromHtml(ChartColors.Red)
             },
             MinorTickMark =
             {
                 LineColor = ColorTranslator.FromHtml(ChartColors.Gray),
                 Size = 2
             },
             LabelStyle =
             {
                 Font = (Font)defaultFont.Clone()
             },
             LabelAutoFitMinFontSize = 8,
             LabelAutoFitMaxFontSize = 10,
             LabelAutoFitStyle = LabelAutoFitStyles.StaggeredLabels
         }
     };
 }
Пример #36
0
	    private Chart SetupChart(string chartId)
        {
            //The Chart definition and look and feel
            var chart = new Chart
                            {
                                ID = chartId,
                                Width = Unit.Pixel(Width),
                                Height = Unit.Pixel(Height)
                            };

            chart.Attributes.Add("aria-hidden", "true");

            if (String.IsNullOrEmpty(AxisXTitle))
                chartAreaHeight = 70;

            var position = new ElementPosition(horizontalOffset, verticalOffset, chartAreaWidth, chartAreaHeight);

            //The ChartArea definition and look and feel
            var chartArea = CreateChartArea(position);

            if (!String.IsNullOrEmpty(AxisYTitle))
            {
                chartArea.AxisY.Title = AxisYTitle;
                chartArea.AxisY.TitleFont = (Font)axisTitleFont.Clone();
            }

            if (AxisYCustomLabels != null && AxisYCustomLabels.Count > 0)
            {
                foreach (var axisYCustomLabel in AxisYCustomLabels)
                {
                    var customLabel = new CustomLabel
                                        {
                                            FromPosition = axisYCustomLabel.FromPosition,
                                            ToPosition = axisYCustomLabel.ToPosition,
                                            Text = axisYCustomLabel.Text
                                        };

                    if (axisYCustomLabel.DisplayGridTick)
                        customLabel.GridTicks = GridTickTypes.TickMark;

                    chartArea.AxisY.CustomLabels.Add(customLabel);
                }
                
            }

            if (!String.IsNullOrEmpty(AxisXTitle))
            {
                chartArea.AxisX.Title = AxisXTitle;
                chartArea.AxisX.TitleFont = (Font)axisTitleFont.Clone();
            }

            //Adding the ChartArea to the Chart.
            chart.ChartAreas.Add(chartArea);

            if (DisplayLegend)
            {
                var displayLegend = new Legend(displayLegendName)
                                        {
                                            Alignment = StringAlignment.Center,
                                            Font = (Font)defaultFont.Clone()
                                        };

                chart.Legends.Add(displayLegend);

                var hideLegend = new Legend(hideLegendName)
                                        {
                                            Enabled = false
                                        };

                chart.Legends.Add(hideLegend);
            }

            return chart;
        }