예제 #1
0
        private async void findReferencesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DataLabel selectedLabel = (DataLabel)dataLabelBox.SelectedItem;
            var       res           = await disassembler.SearchForReferenceAsync(selectedLabel);

            UpdateMainTextBox(res);
        }
예제 #2
0
 public PropulsionSensor(List <ESCData> data) : base(0x02, 12, data)
 {
     rpm  = new List <BarGraph>();
     temp = new List <DataLabel>();
     for (int y = 100; y < 280; y += 30)
     {
         BarGraph rpmGraph = new BarGraph("RPM", "{0:0000}", "", Color.Green,
                                          0, 5000, 50)
         {
             Location = new Point(60, y)
         };
         DataLabel tempGraph = new DataLabel
         {
             Info     = "T",
             Format   = "{0:000}",
             Unit     = "°C",
             Location = new Point(185, y)
         };
         rpm.Add(rpmGraph);
         temp.Add(tempGraph);
         Controls.Add(rpmGraph);
         Controls.Add(tempGraph);
     }
     UpdateControls();
 }
예제 #3
0
        private void houseLabel_DragDrop(object sender, DragEventArgs e)
        {
            DataLabel label = (DataLabel)sender;

            label.BackColor = Color.Transparent;
            owner.resetHeight();
            //this.Hide();

            try
            {
                String[] files = e.Data.GetData(DataFormats.FileDrop, false) as String[];
                // 判断文件类型
                //uploadDetail.uploadFiles(files, category);
                owner.showUploadDetailWin();
                owner.uploadFiles(files, label.data);
                //if (UploadHelper.uploadingFileCount != 0)
                //{
                //    owner.pictureBox1.Image = GovDocSearch.Properties.Resources.小蜜蜜0005;
                //}
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (StatusLabel != null)
            {
                StatusLabel.Dispose();
                StatusLabel = null;
            }

            if (DataLabel != null)
            {
                DataLabel.Dispose();
                DataLabel = null;
            }

            if (GetDataButton != null)
            {
                GetDataButton.Dispose();
                GetDataButton = null;
            }

            if (LoginButton != null)
            {
                LoginButton.Dispose();
                LoginButton = null;
            }

            if (RegisterButton != null)
            {
                RegisterButton.Dispose();
                RegisterButton = null;
            }
        }
예제 #5
0
 public DiagnosticsSensor(VersionData data) : base(0x05, 2, data)
 {
     version = new DataLabel
     {
         AutoSize = true,
         Info     = "Autopilot Firmware",
         Location = new Point(0, 0),
         Text     = ""
     };
     Controls.Add(version);
 }
예제 #6
0
 public ImageDisplayForm(BinFile dt, DataLabel ds)
 {
     InitializeComponent();
     dst      = ds;
     bin      = dt;
     gbs      = ds.Palette;
     labelOff = ds.Offset;
     labelLen = ds.Length;
     SetColors();
     InitializeImage();
 }
예제 #7
0
        private void okButton_Click(object sender, EventArgs e)
        {
            bool checkNameCollision = editingMode == LabelEditMode.Add ?
                                      true :
                                      !nameBox.Text.Equals(editedLabel.Name, StringComparison.Ordinal);
            int    off = -1;
            int    len = 0;
            Symbol sym = new Symbol()
            {
                Name = nameBox.Text
            };

            if (!Utility.IsWord(nameBox.Text))
            {
                Error.ShowErrorMessage(ErrorMessage.Label_InvalidName);
            }
            else if (checkNameCollision && labelContainer.IsSymbolDefined(sym))
            {
                Error.ShowErrorMessage(ErrorMessage.Label_NameAlreadyDefined);
            }
            else if (!Utility.OffsetStringToInt(offsetBox.Text, out off))
            {
                Error.ShowErrorMessage(ErrorMessage.Label_InvalidOffset);
            }
            else if (!Int32.TryParse(lengthBox.Text, NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out len) || len <= 0)
            {
                Error.ShowErrorMessage(ErrorMessage.Label_InvalidLength);
            }
            else
            {
                TemplateBuilder tb            = new TemplateBuilder();
                string          input         = dataTemplateBox.Text;
                bool            success       = false;
                CompError       error         = new CompError();
                var             printTemplate = tb.ValidateTemplate(input, ref error, out success);
                if (!success)
                {
                    Error.ShowErrorMessage(error);
                }
                else
                {
                    if (editingMode == LabelEditMode.Edit)
                    {
                        labelContainer.RemoveDataLabel(editedLabel);
                    }
                    editedLabel = new DataLabel(off, len, nameBox.Text, printTemplate, commentBox.Text, (DataSectionType)dataTypeBox.SelectedIndex);
                    labelContainer.AddDataLabel(editedLabel);
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                }
            }
        }
예제 #8
0
        /// <summary>
        /// Creates a data label rendererInfo.
        /// Does not return any renderer info.
        /// </summary>
        internal override RendererInfo Init()
        {
            ChartRendererInfo cri = (ChartRendererInfo)_rendererParms.RendererInfo;
            foreach (SeriesRendererInfo sri in cri.seriesRendererInfos)
            {
                if (cri._chart._hasDataLabel || cri._chart._dataLabel != null ||
                    sri._series._hasDataLabel || sri._series._dataLabel != null)
                {
                    DataLabelRendererInfo dlri = new DataLabelRendererInfo();

                    DataLabel dl = sri._series._dataLabel;
                    if (dl == null)
                        dl = cri._chart._dataLabel;
                    if (dl == null)
                    {
                        dlri.Format = "0";
                        dlri.Font = cri.DefaultDataLabelFont;
                        dlri.FontColor = new XSolidBrush(XColors.Black);
                        dlri.Position = DataLabelPosition.InsideEnd;
                        if (cri._chart._type == ChartType.Pie2D || cri._chart._type == ChartType.PieExploded2D)
                            dlri.Type = DataLabelType.Percent;
                        else
                            dlri.Type = DataLabelType.Value;
                    }
                    else
                    {
                        dlri.Format = dl.Format.Length > 0 ? dl.Format : "0";
                        dlri.Font = Converter.ToXFont(dl._font, cri.DefaultDataLabelFont);
                        dlri.FontColor = Converter.ToXBrush(dl._font, XColors.Black);
                        if (dl._positionInitialized)
                            dlri.Position = dl._position;
                        else
                            dlri.Position = DataLabelPosition.OutsideEnd;
                        if (dl._typeInitialized)
                            dlri.Type = dl._type;
                        else
                        {
                            if (cri._chart._type == ChartType.Pie2D || cri._chart._type == ChartType.PieExploded2D)
                                dlri.Type = DataLabelType.Percent;
                            else
                                dlri.Type = DataLabelType.Value;
                        }
                    }

                    sri._dataLabelRendererInfo = dlri;
                }
            }

            return null;
        }
예제 #9
0
        public OpenXmlElement GetOrCreateDataLabelAdjust()
        {
            OpenXmlElement dataLabel       = this.series.GetOrCreateDataLabel();
            DataLabel      dataLabelAdjust = dataLabel.Elements <DataLabel>().Where(dl => dl.Index?.Val <= this.valueIndex).LastOrDefault();

            if (!(dataLabelAdjust?.Index?.Val?.HasValue ?? false) || dataLabelAdjust.Index.Val != this.valueIndex)
            {
                dataLabelAdjust = dataLabel.InsertAfter(
                    new DataLabel()
                {
                    Index = new Index()
                    {
                        Val = this.valueIndex
                    },
                }
                    //    .AppendChildFluent(new Delete() { Val = false })
                    .AppendChildFluent(new ShowLegendKey()
                {
                    Val = false
                })
                    .AppendChildFluent(new ShowValue()
                {
                    Val = false
                })
                    .AppendChildFluent(new ShowCategoryName()
                {
                    Val = false
                })
                    .AppendChildFluent(new ShowSeriesName()
                {
                    Val = false
                })
                    .AppendChildFluent(new ShowPercent()
                {
                    Val = false
                })
                    .AppendChildFluent(new ShowBubbleSize()
                {
                    Val = true
                })
                    .AppendChildFluent(new ShowLeaderLines()
                {
                    Val = true
                }),
                    dataLabelAdjust
                    );
            }

            return(dataLabelAdjust);
        }
예제 #10
0
        private void exportToBinaryFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Title    = "Export Data Section To Binary...";
            sfd.Filter   = "Binary File|*.bin|All Files|*";
            sfd.FileName = ((DataLabel)dataLabelBox.SelectedItem).Name;
            if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                DataLabel ds = (DataLabel)dataLabelBox.SelectedItem;
                if (romFile.SaveFilePortion(sfd.FileName, ds.Offset, ds.Length))
                {
                    MessageBox.Show("Binary file successfuly written to " + Environment.NewLine + sfd.FileName);
                }
            }
        }
        /// <summary>
        /// DataLabelModel.Load is used to set the properties of an existing DataLabel object in a FlexChart based control.
        /// The values used are those stored in an existing DataLabelModel class object that is typically created and set by
        /// a standard serializer during deserialization.
        /// </summary>
        /// <param name="dataLabel">Specifies an existing instance of a DataLabel class object.</param>
        /// <param name="dataLabelModel">Specifies an existing instannce of a DataLabelModel class object created by a
        ///                  a standard serializer during deserialization.</param>
        public static void Load(DataLabel dataLabel, DataLabelModel dataLabelModel)
        {
            if (dataLabelModel == null)
            {
                dataLabelModel = new DataLabelModel();
            }

            dataLabel.Border         = dataLabelModel.Border;
            dataLabel.ConnectingLine = dataLabelModel.ConnectingLine;
            dataLabel.Content        = dataLabelModel.Content;
            dataLabel.Offset         = dataLabelModel.Offset;
            dataLabel.Position       = dataLabelModel.Position;

            ((IDataLabel)dataLabel).SetStyle(StyleSerializer.StyleFromString(dataLabelModel.Style), "_");
            ((IDataLabel)dataLabel).SetStyle(StyleSerializer.StyleFromString(dataLabelModel.BorderStyle), "_Border");
        }
예제 #12
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            Canvas.SetTop(Rectangle, current.ChartLocation.Y);
            Canvas.SetLeft(Rectangle, current.ChartLocation.X);

            Rectangle.Width  = Width;
            Rectangle.Height = Height;

            if (IsNew)
            {
                Rectangle.Fill = new SolidColorBrush(Colors.Transparent);
            }

            if (HoverShape != null)
            {
                HoverShape.Width  = Width;
                HoverShape.Height = Height;
                Canvas.SetLeft(HoverShape, current.ChartLocation.X);
                Canvas.SetTop(HoverShape, current.ChartLocation.Y);
            }

            if (DataLabel != null)
            {
                DataLabel.UpdateLayout();
                Canvas.SetTop(DataLabel, current.ChartLocation.Y + (Height / 2) - DataLabel.ActualHeight * .5);
                Canvas.SetLeft(DataLabel, current.ChartLocation.X + (Width / 2) - DataLabel.ActualWidth * .5);
            }

            var targetColor = new Color
            {
                A = ColorComponents.A,
                R = ColorComponents.R,
                G = ColorComponents.G,
                B = ColorComponents.B
            };

            if (chart.View.DisableAnimations)
            {
                Rectangle.Fill = new SolidColorBrush(targetColor);
                return;
            }

            var animSpeed = chart.View.AnimationsSpeed;

            Rectangle.Fill.BeginAnimation(SolidColorBrush.ColorProperty,
                                          new ColorAnimation(targetColor, animSpeed));
        }
예제 #13
0
        private void addItem(object obj)
        {
            Panel pParent = new Panel();
            Panel p       = new Panel();

            p.AutoScroll = true;
            //p.BackgroundImage = Image.FromFile(@"../../Resources/images/houseBg.png");
            p.BackgroundImage = global::GovDocSearch.Properties.Resources.houseBg;
            p.Width           = 107;
            p.Height          = 32;
            p.Margin          = new Padding(0, 0, 0, 0);
            DataLabel label = new DataLabel();
            Dictionary <string, object> cg = (Dictionary <string, object>)obj;

            label.data = cg;
            //int type = Convert.ToInt32(label.getAttrType("type"));
            //   if (type == 1)
            //   {
            //       label.Text = "公共库-" + label.getAttr("name");
            //   }
            label.Text = label.getAttr("name");
            label.Text = label.Text;
            ToolTip toolTip = new ToolTip();

            toolTip.SetToolTip(label, label.Text); // 鼠标经过浮窗显示账户信息
            label.Dock       = DockStyle.Fill;
            label.Width      = 107;
            label.Height     = 32;
            label.AutoSize   = false;
            label.Font       = new Font("微软雅黑", 8, label.Font.Style);
            label.ForeColor  = Color.White;
            label.TextAlign  = System.Drawing.ContentAlignment.MiddleLeft;
            label.Padding    = new Padding(5, 0, 5, 0);
            label.BackColor  = Color.Transparent;
            label.AllowDrop  = true;
            label.DragEnter += new DragEventHandler(houseLabel_dragEnter);
            label.DragDrop  += new DragEventHandler(houseLabel_DragDrop);
            label.DragLeave += new EventHandler(houseLabel_dragLeave);
            //label.BorderStyle = BorderStyle.FixedSingle;
            p.Controls.Add(label);
            Controls.Add(p);
        }
예제 #14
0
 void MapObject(DataLabel dataLabel, DocumentObjectModel.Shapes.Charts.DataLabel domDataLabel)
 {
     if (!domDataLabel.IsNull("Style"))
     {
         FontMapper.Map(dataLabel.Font, domDataLabel.Document, domDataLabel.Style);
     }
     if (!domDataLabel.IsNull("Font"))
     {
         FontMapper.Map(dataLabel.Font, domDataLabel.Font);
     }
     dataLabel.Format = domDataLabel.Format;
     if (!domDataLabel.IsNull("Position"))
     {
         dataLabel.Position = (DataLabelPosition)domDataLabel.Position;
     }
     if (!domDataLabel.IsNull("Type"))
     {
         dataLabel.Type = (DataLabelType)domDataLabel.Type;
     }
 }
예제 #15
0
        private void SetWaterfallStructure(BarChartSeries seriesItem, Column dataColumn)
        {
            var  dataPoints = seriesItem.Elements <DataPoint>();
            var  labels     = seriesItem.FirstElement <DataLabels>();
            bool isFirstBar = dataColumn.Data[0] != null;

            if (!isFirstBar)
            {
                int       valueToHideInd = dataColumn.Data.IndexOf(dataColumn.Data.First(v => v != null));
                DataPoint dataPoint      = dataPoints.FirstOrDefault(p => p.Index != null && p.Index.Val != null && p.Index.Val.Value == valueToHideInd);
                dataPoint.RemoveAllChildren <ChartShapeProperties>();
                ChartShapeProperties chartShapeProperties = new ChartShapeProperties();
                chartShapeProperties.Append(new A.NoFill());
                dataPoint.Append(chartShapeProperties);
                DataLabel label = labels.Elements <DataLabel>().FirstOrDefault(p => p.Index != null && p.Index.Val != null && p.Index.Val.Value == valueToHideInd);
                if (label != null)
                {
                    label.FirstElement <ShowValue>().Val.Value = false;
                }
            }
            labels.FirstElement <ShowValue>().Val.Value = false;
        }
예제 #16
0
        private void AddSeriesPointLabel(ChartSeries drawSeries, SeriesPoint[] pointLabel, Color color, DistancePosSpeedPacket lenthPosValue, DistancePosSpeedPacket lenthSpeedValue)
        {
            drawSeries.DataLabels.Clear();

            int PosSpeedPointIndex = 0;

            for (int i = 0; i < pointLabel.Length; i++)
            {
                PosSpeedPointIndex = i * 2;

                DataLabel dl = new DataLabel(pointLabel[i]);

                double distance = lenthSpeedValue.InDataArray[PosSpeedPointIndex];
                double speed    = Convert.ToDouble(lenthSpeedValue.InDataArray[PosSpeedPointIndex + 1]) / 100;
                double pos      = Convert.ToDouble(lenthPosValue.InDataArray[PosSpeedPointIndex + 1]) / 100;

                dl.Text = "X:" + pointLabel[i].ValueX.ToString() + "\nY:" + pointLabel[i].ValueY[0].ToString()
                          + "\nDistance: " + distance.ToString() + "\nSpeed: " + speed.ToString() + "\nAzimuth:" + pos.ToString();
                dl.DataLabelVisualStyle = SetupDataLabelStyle(90, color);;

                drawSeries.DataLabels.Add(dl);
            }
        }
예제 #17
0
        private void dataLabelBox_DrawItem(object sender, DrawItemEventArgs e)
        {
            e.DrawBackground();
            if (dataLabelBox.Items.Count > 0)
            {
                DataLabel    ds        = (DataLabel)dataLabelBox.Items[e.Index];
                Brush        itemBrush = Brushes.Black;
                StringFormat sf        = new StringFormat();
                sf.Alignment     = StringAlignment.Near;
                sf.LineAlignment = StringAlignment.Center;
                switch (ds.DSectionType)
                {
                case DataSectionType.Image:
                    itemBrush = Brushes.DeepPink;
                    break;

                default:
                    break;
                }
                e.Graphics.DrawString(ds.ToString(), e.Font, itemBrush, dataLabelBox.GetItemRectangle(e.Index), sf);
            }
            e.DrawFocusRectangle();
        }
예제 #18
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            if (DataLabel != null && double.IsNaN(Canvas.GetLeft(DataLabel)))
            {
                Canvas.SetTop(DataLabel, chart.DrawMargin.Height);
                Canvas.SetLeft(DataLabel, current.ChartLocation.X);
            }

            if (HoverShape != null)
            {
                HoverShape.Width  = Shape != null ? (Shape.Width > 5 ? Shape.Width : 5) : 5;
                HoverShape.Height = Shape != null ? (Shape.Height > 5 ? Shape.Height : 5) : 5;
                Canvas.SetLeft(HoverShape, current.ChartLocation.X - HoverShape.Width / 2);
                Canvas.SetTop(HoverShape, current.ChartLocation.Y - HoverShape.Height / 2);
            }


            Rectangle.Width  = Math.Max(1, DeltaX);
            Rectangle.Height = chart.DrawMargin.Height;
            Canvas.SetLeft(Rectangle, current.ChartLocation.X - DeltaX);
            Canvas.SetTop(Rectangle, chart.DrawMargin.Height - current.ChartLocation.Y);

            if (Shape != null)
            {
                Canvas.SetLeft(Shape, current.ChartLocation.X - Shape.Width / 2);
                Canvas.SetTop(Shape, current.ChartLocation.Y - Shape.Height / 2);
            }

            if (DataLabel != null)
            {
                DataLabel.UpdateLayout();
                var xl = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                var yl = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);
                Canvas.SetLeft(DataLabel, xl);
                Canvas.SetTop(DataLabel, yl);
            }
        }
예제 #19
0
 public AddDataLabelForm(LabelContainer lblContainer, LabelEditMode editMode, DataLabel newPriorLabel = null)
 {
     InitializeComponent();
     labelContainer            = lblContainer;
     editingMode               = editMode;
     editedLabel               = newPriorLabel;
     dataTypeBox.SelectedIndex = 0;
     if (editMode == LabelEditMode.Edit)
     {
         Text = "Edit Data Section";
         if (editedLabel != null)
         {
             nameBox.Text              = editedLabel.Name;
             offsetBox.Text            = editedLabel.Offset.ToString("X");
             lengthBox.Text            = editedLabel.Length.ToString("X");
             dataTypeBox.SelectedIndex = (int)editedLabel.DSectionType;
             if (!String.IsNullOrEmpty(editedLabel.Comment))
             {
                 commentBox.Text = editedLabel.Comment;
             }
             dataTemplateBox.Text = TemplateBuilder.TemplateToString(editedLabel.PrintTemplate);
         }
     }
 }
예제 #20
0
 public StatusSensor(StatusData data) : base(0x04, 3, data)
 {
     panel = new FlowLayoutPanel
     {
         Dock          = DockStyle.Fill,
         FlowDirection = FlowDirection.TopDown,
     };
     status = new DataLabel
     {
         Info     = "Status",
         AutoSize = true
     };
     error = new DataLabel
     {
         AutoSize = true,
         Info     = "Error"
     };
     voltage = new BarGraph("Voltage", "{0:#0.0}", "V", Color.Green, 0, 20, 100);
     panel.Controls.Add(status);
     panel.Controls.Add(error);
     panel.Controls.Add(voltage);
     Controls.Add(panel);
     UpdateControls();
 }
예제 #21
0
 protected void FlattenDataLabel(DataLabel dataLabel)
 {
 }
예제 #22
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            if (IsNew)
            {
                Canvas.SetTop(Rectangle, Data.Top);
                Canvas.SetLeft(Rectangle, ZeroReference);

                Rectangle.Width  = 0;
                Rectangle.Height = Data.Height;

                if (DataLabel != null)
                {
                    Canvas.SetTop(DataLabel, Data.Top);
                    Canvas.SetLeft(DataLabel, ZeroReference);
                }
            }

            Func <double> getY = () =>
            {
                var r = Data.Top + Data.Height / 2 - DataLabel.ActualHeight / 2;

                if (r < 0)
                {
                    r = 2;
                }
                if (r + DataLabel.ActualHeight > chart.DrawMargin.Height)
                {
                    r -= r + DataLabel.ActualHeight - chart.DrawMargin.Height + 2;
                }

                return(r);
            };

            Func <double> getX = () =>
            {
                double r;

                if (LabelPosition == BarLabelPosition.Merged)
                {
                    r = Data.Left + Data.Width / 2 - DataLabel.ActualWidth / 2;
                }
                else
                {
                    if (Data.Left < ZeroReference)
                    {
                        r = Data.Left - DataLabel.ActualWidth - 5;
                        if (r < 0)
                        {
                            r = Data.Left + 5;
                        }
                    }
                    else
                    {
                        r = Data.Left + Data.Width + 5;
                        if (r + DataLabel.ActualWidth > chart.DrawMargin.Width)
                        {
                            r -= DataLabel.ActualWidth + 10;
                        }
                    }
                }

                return(r);
            };

            if (chart.View.DisableAnimations)
            {
                Rectangle.Width  = Data.Width;
                Rectangle.Height = Data.Height;

                Canvas.SetTop(Rectangle, Data.Top);
                Canvas.SetLeft(Rectangle, Data.Left);

                if (DataLabel != null)
                {
                    DataLabel.UpdateLayout();

                    Canvas.SetTop(DataLabel, getY());
                    Canvas.SetLeft(DataLabel, getX());
                }

                if (HoverShape != null)
                {
                    Canvas.SetTop(HoverShape, Data.Top);
                    Canvas.SetLeft(HoverShape, Data.Left);
                    HoverShape.Height = Data.Height;
                    HoverShape.Width  = Data.Width;
                }

                return;
            }

            var animSpeed = chart.View.AnimationsSpeed;

            if (DataLabel != null)
            {
                DataLabel.UpdateLayout();

                DataLabel.BeginAnimation(Canvas.LeftProperty, new DoubleAnimation(getX(), animSpeed));
                DataLabel.BeginAnimation(Canvas.TopProperty, new DoubleAnimation(getY(), animSpeed));
            }

            Canvas.SetTop(Rectangle, Data.Top);
            Rectangle.BeginAnimation(Canvas.LeftProperty,
                                     new DoubleAnimation(Data.Left, animSpeed));

            Rectangle.Height = Data.Height;
            Rectangle.BeginAnimation(FrameworkElement.WidthProperty,
                                     new DoubleAnimation(Data.Width, animSpeed));

            if (HoverShape != null)
            {
                Canvas.SetTop(HoverShape, Data.Top);
                Canvas.SetLeft(HoverShape, Data.Left);
                HoverShape.Height = Data.Height;
                HoverShape.Width  = Data.Width;
            }
        }
예제 #23
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            if (IsNew)
            {
                Canvas.SetTop(Rectangle, Data.Top);
                Canvas.SetLeft(Rectangle, ZeroReference);

                Rectangle.Width  = 0;
                Rectangle.Height = Data.Height;
            }

            if (DataLabel != null && double.IsNaN(Canvas.GetLeft(DataLabel)))
            {
                Canvas.SetTop(DataLabel, Data.Top);
                Canvas.SetLeft(DataLabel, ZeroReference);
            }

            Func <double> getY = () =>
            {
                if (LabelPosition == BarLabelPosition.Perpendicular)
                {
                    if (Transform == null)
                    {
                        Transform = new RotateTransform(270);
                    }

                    DataLabel.RenderTransform = Transform;
                    return(Data.Top + Data.Height / 2 + DataLabel.ActualWidth * .5);
                }

                var r = Data.Top + Data.Height / 2 - DataLabel.ActualHeight / 2;

                if (r < 0)
                {
                    r = 2;
                }
                if (r + DataLabel.ActualHeight > chart.DrawMargin.Height)
                {
                    r -= r + DataLabel.ActualHeight - chart.DrawMargin.Height + 2;
                }

                return(r);
            };

            Func <double> getX = () =>
            {
                double r;

#pragma warning disable 618
                if (LabelPosition == BarLabelPosition.Parallel || LabelPosition == BarLabelPosition.Merged)
#pragma warning restore 618
                {
                    r = Data.Left + Data.Width / 2 - DataLabel.ActualWidth / 2;
                }
                else if (LabelPosition == BarLabelPosition.Perpendicular)
                {
                    r = Data.Left + Data.Width / 2 - DataLabel.ActualHeight / 2;
                }
                else
                {
                    if (Data.Left < ZeroReference)
                    {
                        r = Data.Left - DataLabel.ActualWidth - 5;
                        if (r < 0)
                        {
                            r = Data.Left + 5;
                        }
                    }
                    else
                    {
                        r = Data.Left + Data.Width + 5;
                        if (r + DataLabel.ActualWidth > chart.DrawMargin.Width)
                        {
                            r -= DataLabel.ActualWidth + 10;
                        }
                    }
                }

                return(r);
            };

            if (chart.View.DisableAnimations)
            {
                Rectangle.Width  = Data.Width;
                Rectangle.Height = Data.Height;

                Canvas.SetTop(Rectangle, Data.Top);
                Canvas.SetLeft(Rectangle, Data.Left);

                if (DataLabel != null)
                {
                    DataLabel.UpdateLayout();

                    Canvas.SetTop(DataLabel, getY());
                    Canvas.SetLeft(DataLabel, getX());
                }

                if (HoverShape != null)
                {
                    Canvas.SetTop(HoverShape, Data.Top);
                    Canvas.SetLeft(HoverShape, Data.Left);
                    HoverShape.Height = Data.Height;
                    HoverShape.Width  = Data.Width;
                }

                return;
            }

            var animSpeed = chart.View.AnimationsSpeed;

            //if (double.IsNaN(getX()) || double.IsNaN(getY())
            //    return;

            if (DataLabel != null)
            {
                DataLabel.UpdateLayout();

                DataLabel.BeginAnimation(Canvas.LeftProperty, new DoubleAnimation(getX(), animSpeed));
                DataLabel.BeginAnimation(Canvas.TopProperty, new DoubleAnimation(getY(), animSpeed));
            }

            Rectangle.BeginAnimation(Canvas.TopProperty,
                                     new DoubleAnimation(Data.Top, animSpeed));
            Rectangle.BeginAnimation(Canvas.LeftProperty,
                                     new DoubleAnimation(Data.Left, animSpeed));

            Rectangle.BeginAnimation(FrameworkElement.HeightProperty,
                                     new DoubleAnimation(Data.Height, animSpeed));
            Rectangle.BeginAnimation(FrameworkElement.WidthProperty,
                                     new DoubleAnimation(Data.Width, animSpeed));

            if (HoverShape != null)
            {
                Canvas.SetTop(HoverShape, Data.Top);
                Canvas.SetLeft(HoverShape, Data.Left);
                HoverShape.Height = Data.Height;
                HoverShape.Width  = Data.Width;
            }
        }
예제 #24
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            var center = Left + Width / 2;

            if (IsNew)
            {
                HighToLowLine.X1 = center;
                HighToLowLine.X2 = center;
                HighToLowLine.Y1 = StartReference;
                HighToLowLine.Y2 = StartReference;

                OpenLine.X1 = Left;
                OpenLine.X2 = center;
                OpenLine.Y1 = StartReference;
                OpenLine.Y2 = StartReference;

                CloseLine.X1 = center;
                CloseLine.X2 = Left + Width;
                CloseLine.Y1 = StartReference;
                CloseLine.Y2 = StartReference;

                if (DataLabel != null)
                {
                    Canvas.SetTop(DataLabel, current.ChartLocation.Y);
                    Canvas.SetLeft(DataLabel, current.ChartLocation.X);
                }
            }

            if (DataLabel != null && double.IsNaN(Canvas.GetLeft(DataLabel)))
            {
                Canvas.SetTop(DataLabel, current.ChartLocation.Y);
                Canvas.SetLeft(DataLabel, current.ChartLocation.X);
            }

            if (HoverShape != null)
            {
                var h = Math.Abs(High - Low);
                HoverShape.Width  = Width;
                HoverShape.Height = h > 10 ? h : 10;
                Canvas.SetLeft(HoverShape, Left);
                Canvas.SetTop(HoverShape, High);
            }

            if (chart.View.DisableAnimations)
            {
                HighToLowLine.Y1 = High;
                HighToLowLine.Y2 = Low;
                HighToLowLine.X1 = center;
                HighToLowLine.X2 = center;

                OpenLine.Y1 = Open;
                OpenLine.Y2 = Open;
                OpenLine.X1 = Left;
                OpenLine.X2 = center;

                CloseLine.Y1 = Close;
                CloseLine.Y2 = Close;
                CloseLine.X1 = center;
                CloseLine.X2 = Left + Width;

                if (DataLabel != null)
                {
                    DataLabel.UpdateLayout();

                    var cx = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualHeight * .5, chart);
                    var cy = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualWidth * .5, chart);

                    Canvas.SetTop(DataLabel, cy);
                    Canvas.SetLeft(DataLabel, cx);
                }

                return;
            }

            var animSpeed = chart.View.AnimationsSpeed;

            if (DataLabel != null)
            {
                DataLabel.UpdateLayout();

                var cx = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                var cy = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);

                DataLabel.BeginAnimation(Canvas.LeftProperty, new DoubleAnimation(cx, animSpeed));
                DataLabel.BeginAnimation(Canvas.TopProperty, new DoubleAnimation(cy, animSpeed));
            }

            HighToLowLine.BeginAnimation(Line.X1Property, new DoubleAnimation(center, animSpeed));
            HighToLowLine.BeginAnimation(Line.X2Property, new DoubleAnimation(center, animSpeed));
            OpenLine.BeginAnimation(Line.X1Property, new DoubleAnimation(Left, animSpeed));
            OpenLine.BeginAnimation(Line.X2Property, new DoubleAnimation(center, animSpeed));
            CloseLine.BeginAnimation(Line.X1Property, new DoubleAnimation(center, animSpeed));
            CloseLine.BeginAnimation(Line.X2Property, new DoubleAnimation(Left + Width, animSpeed));

            HighToLowLine.BeginAnimation(Line.Y1Property, new DoubleAnimation(High, animSpeed));
            HighToLowLine.BeginAnimation(Line.Y2Property, new DoubleAnimation(Low, animSpeed));
            OpenLine.BeginAnimation(Line.Y1Property, new DoubleAnimation(Open, animSpeed));
            OpenLine.BeginAnimation(Line.Y2Property, new DoubleAnimation(Open, animSpeed));
            CloseLine.BeginAnimation(Line.Y1Property, new DoubleAnimation(Close, animSpeed));
            CloseLine.BeginAnimation(Line.Y2Property, new DoubleAnimation(Close, animSpeed));
        }
예제 #25
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            var previosPbv = previousDrawn == null ? null : (VerticalBezierPointView)previousDrawn.View;

            Container.Segments.Remove(Segment);
            Container.Segments.Insert(index, Segment);

            ValidArea = new CoreRectangle(current.ChartLocation.X - 7.5, current.ChartLocation.Y - 7.5, 15, 15);

            if (IsNew)
            {
                if (previosPbv != null && !previosPbv.IsNew)
                {
                    Segment.Point1 = previosPbv.Segment.Point3;
                    Segment.Point2 = previosPbv.Segment.Point3;
                    Segment.Point3 = previosPbv.Segment.Point3;

                    if (DataLabel != null)
                    {
                        Canvas.SetTop(DataLabel, Canvas.GetTop(previosPbv.DataLabel));
                        Canvas.SetLeft(DataLabel, Canvas.GetLeft(previosPbv.DataLabel));
                    }

                    if (Shape != null)
                    {
                        Canvas.SetTop(Shape, Canvas.GetTop(previosPbv.Shape));
                        Canvas.SetLeft(Shape, Canvas.GetLeft(previosPbv.Shape));
                    }
                }
                else
                {
                    if (current.SeriesView.IsFirstDraw)
                    {
                        Segment.Point1 = new Point(0, Data.Point1.Y);
                        Segment.Point2 = new Point(0, Data.Point2.Y);
                        Segment.Point3 = new Point(0, Data.Point3.Y);

                        if (Shape != null)
                        {
                            Canvas.SetTop(Shape, current.ChartLocation.Y - Shape.Height * .5);
                            Canvas.SetLeft(Shape, 0);
                        }
                        if (DataLabel != null)
                        {
                            Canvas.SetTop(DataLabel, current.ChartLocation.Y - DataLabel.ActualHeight * .5);
                            Canvas.SetLeft(DataLabel, 0);
                        }
                    }
                    else
                    {
                        var startPoint = ((LineSeries)current.SeriesView).Splitters[0].Left.Point;
                        Segment.Point1 = startPoint;
                        Segment.Point2 = startPoint;
                        Segment.Point3 = startPoint;

                        if (Shape != null)
                        {
                            Canvas.SetTop(Shape, startPoint.Y - Shape.Height * .5);
                            Canvas.SetLeft(Shape, startPoint.X);
                        }
                        if (DataLabel != null)
                        {
                            Canvas.SetTop(DataLabel, startPoint.Y - DataLabel.ActualHeight * .5);
                            Canvas.SetLeft(DataLabel, startPoint.X);
                        }
                    }
                }
            }
            else if (DataLabel != null && double.IsNaN(Canvas.GetLeft(DataLabel)))
            {
                Canvas.SetTop(DataLabel, current.ChartLocation.Y - DataLabel.ActualHeight * .5);
                Canvas.SetLeft(DataLabel, 0);
            }

            #region No Animated

            if (chart.View.DisableAnimations)
            {
                Segment.Point1 = Data.Point1.AsPoint();
                Segment.Point2 = Data.Point2.AsPoint();
                Segment.Point3 = Data.Point3.AsPoint();

                if (HoverShape != null)
                {
                    Canvas.SetLeft(HoverShape, current.ChartLocation.X - HoverShape.Width * .5);
                    Canvas.SetTop(HoverShape, current.ChartLocation.Y - HoverShape.Height * .5);
                }

                if (Shape != null)
                {
                    Canvas.SetLeft(Shape, current.ChartLocation.X - Shape.Width * .5);
                    Canvas.SetTop(Shape, current.ChartLocation.Y - Shape.Height * .5);
                }

                if (DataLabel != null)
                {
                    DataLabel.UpdateLayout();
                    var xl = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                    var yl = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);
                    Canvas.SetLeft(DataLabel, xl);
                    Canvas.SetTop(DataLabel, yl);
                }
                return;
            }

            #endregion

            Segment.BeginAnimation(BezierSegment.Point1Property,
                                   new PointAnimation(Segment.Point1, Data.Point1.AsPoint(), chart.View.AnimationsSpeed));
            Segment.BeginAnimation(BezierSegment.Point2Property,
                                   new PointAnimation(Segment.Point2, Data.Point2.AsPoint(), chart.View.AnimationsSpeed));
            Segment.BeginAnimation(BezierSegment.Point3Property,
                                   new PointAnimation(Segment.Point3, Data.Point3.AsPoint(), chart.View.AnimationsSpeed));

            if (Shape != null)
            {
                if (double.IsNaN(Canvas.GetLeft(Shape)))
                {
                    Canvas.SetLeft(Shape, current.ChartLocation.X - Shape.Width * .5);
                    Canvas.SetTop(Shape, current.ChartLocation.Y - Shape.Height * .5);
                }
                else
                {
                    Shape.BeginAnimation(Canvas.LeftProperty,
                                         new DoubleAnimation(current.ChartLocation.X - Shape.Width * .5, chart.View.AnimationsSpeed));
                    Shape.BeginAnimation(Canvas.TopProperty,
                                         new DoubleAnimation(current.ChartLocation.Y - Shape.Height * .5, chart.View.AnimationsSpeed));
                }
            }

            if (DataLabel != null)
            {
                DataLabel.UpdateLayout();

                var xl = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                var yl = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);

                DataLabel.BeginAnimation(Canvas.LeftProperty,
                                         new DoubleAnimation(xl, chart.View.AnimationsSpeed));
                DataLabel.BeginAnimation(Canvas.TopProperty,
                                         new DoubleAnimation(yl, chart.View.AnimationsSpeed));
            }

            if (HoverShape != null)
            {
                Canvas.SetLeft(HoverShape, current.ChartLocation.X - HoverShape.Width * .5);
                Canvas.SetTop(HoverShape, current.ChartLocation.Y - HoverShape.Height * .5);
            }
        }
예제 #26
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            var previosPbv = previousDrawn == null
                ? null
                : (HorizontalBezierPointView)previousDrawn.View;

            var y = chart.DrawMargin.Top + chart.DrawMargin.Height;

            Container.Segments.Remove(Segment);
            Container.Segments.Insert(index, Segment);

            if (IsNew)
            {
                if (previosPbv != null && !previosPbv.IsNew)
                {
                    Segment.Point1 = previosPbv.Segment.Point3;
                    Segment.Point2 = previosPbv.Segment.Point3;
                    Segment.Point3 = previosPbv.Segment.Point3;

                    if (DataLabel != null)
                    {
                        Canvas.SetTop(DataLabel, Canvas.GetTop(previosPbv.DataLabel));
                        Canvas.SetLeft(DataLabel, Canvas.GetLeft(previosPbv.DataLabel));
                    }

                    if (Shape != null)
                    {
                        Canvas.SetTop(Shape, Canvas.GetTop(previosPbv.Shape));
                        Canvas.SetLeft(Shape, Canvas.GetLeft(previosPbv.Shape));
                    }
                }
                else
                {
                    Segment.Point1 = new Point(Data.Point1.X, y);
                    Segment.Point2 = new Point(Data.Point2.X, y);
                    Segment.Point3 = new Point(Data.Point3.X, y);

                    if (DataLabel != null)
                    {
                        Canvas.SetTop(DataLabel, y);
                        Canvas.SetLeft(DataLabel, current.ChartLocation.X - DataLabel.ActualWidth * .5);
                    }

                    if (Shape != null)
                    {
                        Canvas.SetTop(Shape, y);
                        Canvas.SetLeft(Shape, current.ChartLocation.X - Shape.Width * .5);
                    }
                }
            }
            else if (DataLabel != null && double.IsNaN(Canvas.GetLeft(DataLabel)))
            {
                Canvas.SetTop(DataLabel, y);
                Canvas.SetLeft(DataLabel, current.ChartLocation.X - DataLabel.ActualWidth * .5);
            }

            #region No Animated

            if (chart.View.DisableAnimations)
            {
                Segment.Point1 = Data.Point1.AsPoint();
                Segment.Point2 = Data.Point2.AsPoint();
                Segment.Point3 = Data.Point3.AsPoint();

                if (HoverShape != null)
                {
                    Canvas.SetLeft(HoverShape, current.ChartLocation.X - HoverShape.Width * .5);
                    Canvas.SetTop(HoverShape, current.ChartLocation.Y - HoverShape.Height * .5);
                }

                if (Shape != null)
                {
                    Canvas.SetLeft(Shape, current.ChartLocation.X - Shape.Width * .5);
                    Canvas.SetTop(Shape, current.ChartLocation.Y - Shape.Height * .5);
                }

                if (DataLabel != null)
                {
                    DataLabel.UpdateLayout();
                    var xl = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                    var yl = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);
                    Canvas.SetLeft(DataLabel, xl);
                    Canvas.SetTop(DataLabel, yl);
                }
                return;
            }

            #endregion

            var animSpeed = chart.View.AnimationsSpeed;

            Segment.BeginPointAnimation(nameof(BezierSegment.Point1), Data.Point1.AsPoint(), animSpeed);
            Segment.BeginPointAnimation(nameof(BezierSegment.Point2), Data.Point2.AsPoint(), animSpeed);
            Segment.BeginPointAnimation(nameof(BezierSegment.Point3), Data.Point3.AsPoint(), animSpeed);

            if (Shape != null)
            {
                if (double.IsNaN(Canvas.GetLeft(Shape)))
                {
                    Canvas.SetLeft(Shape, current.ChartLocation.X - Shape.Width * .5);
                    Canvas.SetTop(Shape, current.ChartLocation.Y - Shape.Height * .5);
                }
                else
                {
                    Shape.CreateCanvasStoryBoardAndBegin(current.ChartLocation.X - Shape.Width * .5,
                                                         current.ChartLocation.Y - Shape.Height * .5, chart.View.AnimationsSpeed);
                }
            }

            if (DataLabel != null)
            {
                DataLabel.UpdateLayout();

                var xl = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                var yl = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);

                DataLabel.CreateCanvasStoryBoardAndBegin(xl, yl, chart.View.AnimationsSpeed);
            }

            if (HoverShape != null)
            {
                Canvas.SetLeft(HoverShape, current.ChartLocation.X - HoverShape.Width * .5);
                Canvas.SetTop(HoverShape, current.ChartLocation.Y - HoverShape.Height * .5);
            }
        }
예제 #27
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            if (IsNew)
            {
                Canvas.SetTop(Ellipse, current.ChartLocation.Y);
                Canvas.SetLeft(Ellipse, current.ChartLocation.X);

                Ellipse.Width  = 0;
                Ellipse.Height = 0;

                if (DataLabel != null)
                {
                    Canvas.SetTop(DataLabel, current.ChartLocation.Y);
                    Canvas.SetLeft(DataLabel, current.ChartLocation.X);
                }
            }

            if (HoverShape != null)
            {
                HoverShape.Width  = Diameter;
                HoverShape.Height = Diameter;
                Canvas.SetLeft(HoverShape, current.ChartLocation.X - Diameter / 2);
                Canvas.SetTop(HoverShape, current.ChartLocation.Y - Diameter / 2);
            }

            if (chart.View.DisableAnimations)
            {
                Ellipse.Width  = Diameter;
                Ellipse.Height = Diameter;

                Canvas.SetTop(Ellipse, current.ChartLocation.Y - Ellipse.Width * .5);
                Canvas.SetLeft(Ellipse, current.ChartLocation.X - Ellipse.Height * .5);

                if (DataLabel != null)
                {
                    DataLabel.UpdateLayout();

                    var cx = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualHeight * .5, chart);
                    var cy = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);

                    Canvas.SetTop(DataLabel, cy);
                    Canvas.SetLeft(DataLabel, cx);
                }

                return;
            }

            var animSpeed = chart.View.AnimationsSpeed;

            if (DataLabel != null)
            {
                DataLabel.UpdateLayout();

                var cx = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                var cy = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);

                DataLabel.BeginAnimation(Canvas.LeftProperty, new DoubleAnimation(cx, animSpeed));
                DataLabel.BeginAnimation(Canvas.TopProperty, new DoubleAnimation(cy, animSpeed));
            }

            Ellipse.BeginAnimation(FrameworkElement.WidthProperty,
                                   new DoubleAnimation(Diameter, animSpeed));
            Ellipse.BeginAnimation(FrameworkElement.HeightProperty,
                                   new DoubleAnimation(Diameter, animSpeed));

            Ellipse.BeginAnimation(Canvas.TopProperty,
                                   new DoubleAnimation(current.ChartLocation.Y - Diameter * .5, animSpeed));
            Ellipse.BeginAnimation(Canvas.LeftProperty,
                                   new DoubleAnimation(current.ChartLocation.X - Diameter * .5, animSpeed));
        }
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            var invertedMode = ((StepLineSeries)current.SeriesView).InvertedMode;

            if (IsNew)
            {
                if (invertedMode)
                {
                    Line1.X1 = current.ChartLocation.X;
                    Line1.X2 = current.ChartLocation.X - DeltaX;
                    Line1.Y1 = chart.DrawMargin.Height;
                    Line1.Y2 = chart.DrawMargin.Height;

                    Line2.X1 = current.ChartLocation.X - DeltaX;
                    Line2.X2 = current.ChartLocation.X - DeltaX;
                    Line2.Y1 = chart.DrawMargin.Height;
                    Line2.Y2 = chart.DrawMargin.Height;
                }
                else
                {
                    Line1.X1 = current.ChartLocation.X;
                    Line1.X2 = current.ChartLocation.X;
                    Line1.Y1 = chart.DrawMargin.Height;
                    Line1.Y2 = chart.DrawMargin.Height;

                    Line2.X1 = current.ChartLocation.X - DeltaX;
                    Line2.X2 = current.ChartLocation.X;
                    Line2.Y1 = chart.DrawMargin.Height;
                    Line2.Y2 = chart.DrawMargin.Height;
                }

                if (Shape != null)
                {
                    Canvas.SetLeft(Shape, current.ChartLocation.X - Shape.Width / 2);
                    Canvas.SetTop(Shape, chart.DrawMargin.Height);
                }
            }

            if (DataLabel != null && double.IsNaN(Canvas.GetLeft(DataLabel)))
            {
                Canvas.SetTop(DataLabel, chart.DrawMargin.Height);
                Canvas.SetLeft(DataLabel, current.ChartLocation.X);
            }

            if (HoverShape != null)
            {
                HoverShape.Width  = Shape != null ? Shape.Width > 5 ? Shape.Width : 5 : 5;
                HoverShape.Height = Shape != null ? Shape.Height > 5 ? Shape.Height : 5 : 5;
                Canvas.SetLeft(HoverShape, current.ChartLocation.X - HoverShape.Width / 2);
                Canvas.SetTop(HoverShape, current.ChartLocation.Y - HoverShape.Height / 2);
            }

            if (chart.View.DisableAnimations)
            {
                if (invertedMode)
                {
                    Line1.X1 = current.ChartLocation.X;
                    Line1.X2 = current.ChartLocation.X - DeltaX;
                    Line1.Y1 = current.ChartLocation.Y;
                    Line1.Y2 = current.ChartLocation.Y;

                    Line2.X1 = current.ChartLocation.X - DeltaX;
                    Line2.X2 = current.ChartLocation.X - DeltaX;
                    Line2.Y1 = current.ChartLocation.Y;
                    Line2.Y2 = current.ChartLocation.Y - DeltaY;
                }
                else
                {
                    Line1.X1 = current.ChartLocation.X;
                    Line1.X2 = current.ChartLocation.X;
                    Line1.Y1 = current.ChartLocation.Y;
                    Line1.Y2 = current.ChartLocation.Y - DeltaY;

                    Line2.X1 = current.ChartLocation.X - DeltaX;
                    Line2.X2 = current.ChartLocation.X;
                    Line2.Y1 = current.ChartLocation.Y - DeltaY;
                    Line2.Y2 = current.ChartLocation.Y - DeltaY;
                }

                if (Shape != null)
                {
                    Canvas.SetLeft(Shape, current.ChartLocation.X - Shape.Width / 2);
                    Canvas.SetTop(Shape, current.ChartLocation.Y - Shape.Height / 2);
                }

                if (DataLabel != null)
                {
                    DataLabel.UpdateLayout();
                    var xl = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                    var yl = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);
                    Canvas.SetLeft(DataLabel, xl);
                    Canvas.SetTop(DataLabel, yl);
                }

                return;
            }

            var animSpeed = chart.View.AnimationsSpeed;

            if (invertedMode)
            {
                Line1.BeginAnimation(Line.X1Property,
                                     new DoubleAnimation(current.ChartLocation.X, animSpeed));
                Line1.BeginAnimation(Line.X2Property,
                                     new DoubleAnimation(current.ChartLocation.X - DeltaX, animSpeed));
                Line1.BeginAnimation(Line.Y1Property,
                                     new DoubleAnimation(current.ChartLocation.Y, animSpeed));
                Line1.BeginAnimation(Line.Y2Property,
                                     new DoubleAnimation(current.ChartLocation.Y, animSpeed));

                Line2.BeginAnimation(Line.X1Property,
                                     new DoubleAnimation(current.ChartLocation.X - DeltaX, animSpeed));
                Line2.BeginAnimation(Line.X2Property,
                                     new DoubleAnimation(current.ChartLocation.X - DeltaX, animSpeed));
                Line2.BeginAnimation(Line.Y1Property,
                                     new DoubleAnimation(current.ChartLocation.Y, animSpeed));
                Line2.BeginAnimation(Line.Y2Property,
                                     new DoubleAnimation(current.ChartLocation.Y - DeltaY, animSpeed));
            }
            else
            {
                Line1.BeginAnimation(Line.X1Property,
                                     new DoubleAnimation(current.ChartLocation.X, animSpeed));
                Line1.BeginAnimation(Line.X2Property,
                                     new DoubleAnimation(current.ChartLocation.X, animSpeed));
                Line1.BeginAnimation(Line.Y1Property,
                                     new DoubleAnimation(current.ChartLocation.Y, animSpeed));
                Line1.BeginAnimation(Line.Y2Property,
                                     new DoubleAnimation(current.ChartLocation.Y - DeltaY, animSpeed));

                Line2.BeginAnimation(Line.X1Property,
                                     new DoubleAnimation(current.ChartLocation.X - DeltaX, animSpeed));
                Line2.BeginAnimation(Line.X2Property,
                                     new DoubleAnimation(current.ChartLocation.X, animSpeed));
                Line2.BeginAnimation(Line.Y1Property,
                                     new DoubleAnimation(current.ChartLocation.Y - DeltaY, animSpeed));
                Line2.BeginAnimation(Line.Y2Property,
                                     new DoubleAnimation(current.ChartLocation.Y - DeltaY, animSpeed));
            }

            if (Shape != null)
            {
                Shape.BeginAnimation(Canvas.LeftProperty,
                                     new DoubleAnimation(current.ChartLocation.X - Shape.Width / 2, animSpeed));
                Shape.BeginAnimation(Canvas.TopProperty,
                                     new DoubleAnimation(current.ChartLocation.Y - Shape.Height / 2, animSpeed));
            }

            if (DataLabel != null)
            {
                DataLabel.UpdateLayout();
                var xl = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                var yl = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);
                Canvas.SetLeft(DataLabel, xl);
                Canvas.SetTop(DataLabel, yl);
            }
        }
예제 #29
0
        public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
        {
            if (IsNew)
            {
                VerticalLine.X1 = current.ChartLocation.X;
                VerticalLine.X2 = current.ChartLocation.X;
                VerticalLine.Y1 = chart.DrawMargin.Height;
                VerticalLine.Y2 = chart.DrawMargin.Height;

                HorizontalLine.X1 = current.ChartLocation.X - DeltaX;
                HorizontalLine.X2 = current.ChartLocation.X;
                HorizontalLine.Y1 = chart.DrawMargin.Height;
                HorizontalLine.Y2 = chart.DrawMargin.Height;

                if (Shape != null)
                {
                    Canvas.SetLeft(Shape, current.ChartLocation.X - Shape.Width / 2);
                    Canvas.SetTop(Shape, chart.DrawMargin.Height);
                }
            }

            if (DataLabel != null && double.IsNaN(Canvas.GetLeft(DataLabel)))
            {
                Canvas.SetTop(DataLabel, chart.DrawMargin.Height);
                Canvas.SetLeft(DataLabel, current.ChartLocation.X);
            }

            if (HoverShape != null)
            {
                HoverShape.Width  = Shape != null ? (Shape.Width > 5 ? Shape.Width : 5) : 5;
                HoverShape.Height = Shape != null ? (Shape.Height > 5 ? Shape.Height : 5) : 5;
                Canvas.SetLeft(HoverShape, current.ChartLocation.X - HoverShape.Width / 2);
                Canvas.SetTop(HoverShape, current.ChartLocation.Y - HoverShape.Height / 2);
            }

            if (chart.View.DisableAnimations)
            {
                VerticalLine.X1 = current.ChartLocation.X;
                VerticalLine.X2 = current.ChartLocation.X;
                VerticalLine.Y1 = current.ChartLocation.Y;
                VerticalLine.Y2 = current.ChartLocation.Y - DeltaY;

                HorizontalLine.X1 = current.ChartLocation.X - DeltaX;
                HorizontalLine.X2 = current.ChartLocation.X;
                HorizontalLine.Y1 = current.ChartLocation.Y - DeltaY;
                HorizontalLine.Y2 = current.ChartLocation.Y - DeltaY;

                if (Shape != null)
                {
                    Canvas.SetLeft(Shape, current.ChartLocation.X - Shape.Width / 2);
                    Canvas.SetTop(Shape, current.ChartLocation.Y - Shape.Height / 2);
                }

                if (DataLabel != null)
                {
                    DataLabel.UpdateLayout();
                    var xl = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                    var yl = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);
                    Canvas.SetLeft(DataLabel, xl);
                    Canvas.SetTop(DataLabel, yl);
                }

                return;
            }

            var animSpeed = chart.View.AnimationsSpeed;

            VerticalLine.BeginDoubleAnimation(nameof(Line.X1), current.ChartLocation.X, animSpeed);
            VerticalLine.BeginDoubleAnimation(nameof(Line.X2), current.ChartLocation.X, animSpeed);
            VerticalLine.BeginDoubleAnimation(nameof(Line.Y1), current.ChartLocation.Y, animSpeed);
            VerticalLine.BeginDoubleAnimation(nameof(Line.Y2), current.ChartLocation.Y - DeltaY, animSpeed);

            HorizontalLine.BeginDoubleAnimation(nameof(Line.X1), current.ChartLocation.X - DeltaX, animSpeed);
            HorizontalLine.BeginDoubleAnimation(nameof(Line.X2), current.ChartLocation.X, animSpeed);
            HorizontalLine.BeginDoubleAnimation(nameof(Line.Y1), current.ChartLocation.Y - DeltaY, animSpeed);
            HorizontalLine.BeginDoubleAnimation(nameof(Line.Y2), current.ChartLocation.Y - DeltaY, animSpeed);

            Shape?.CreateCanvasStoryBoardAndBegin(current.ChartLocation.X - Shape.Width / 2,
                                                  current.ChartLocation.Y - Shape.Height / 2, animSpeed);

            if (DataLabel == null)
            {
                return;
            }

            {
                DataLabel.UpdateLayout();
                var xl = CorrectXLabel(current.ChartLocation.X - DataLabel.ActualWidth * .5, chart);
                var yl = CorrectYLabel(current.ChartLocation.Y - DataLabel.ActualHeight * .5, chart);
                Canvas.SetLeft(DataLabel, xl);
                Canvas.SetTop(DataLabel, yl);
            }
        }
 internal DataLabelProperties(DataLabel dataLabel, FlexChartBase chart) : base(dataLabel, chart)
 {
     this.dataLabel = dataLabel;
 }