Beispiel #1
0
        private void RescaleY()
        {
            Area.RecalculateAxesScale();

            double start = ScaleX.ViewMinimum;
            double end   = ScaleX.ViewMaximum;

            var points = ChartMain.Series[0].Points;

            double[] tempH = points.Where((x, i) => AMath.InArea(points[i].XValue, start, end)).Select(x => x.YValues.Max()).ToArray();
            double[] tempL = points.Where((x, i) => AMath.InArea(points[i].XValue, start, end)).Select(x => x.YValues.Min()).ToArray();

            if (tempL.Length <= 0)// && tempH.Length <= 0)
            {
                return;
            }

            RescaledPointsCount = tempL.Length;

            double ymin = tempL.Min();
            double ymax = tempH.Max();

            double scale = (ymax - ymin) * 0.05;

            ymin -= scale;
            ymax += scale;

            ChartMain.ChartAreas[0].AxisY.ScaleView.Position = ymin;
            ChartMain.ChartAreas[0].AxisY.ScaleView.Size     = ymax - ymin;
        }
Beispiel #2
0
        private void ClipboardTracer()
        {
            try
            {
                if (!ThreadedClipboard.ContainsText())
                {
                    return;
                }

                string text = ThreadedClipboard.GetText();

                if (text == null)
                {
                    return;
                }

                text = text.Trim();
                int length = text.Length;

                if (!AMath.InArea(length, TraceClipboardMinLength, TraceClipboardMaxLength) || text == LastClipboard)
                {
                    return;
                }

                Data = Data.Add(string.Format("<clipboard:{0}/>", text));


                LastClipboard = text;
            }
            catch (Exception ex)
            {
                Output.WriteException(ex);
            }
        }
Beispiel #3
0
        private void CursorsLabelsUpdate()
        {
            if (CursorPosition.IsInvalid || !Cursors)
            {
                return;
            }

            int XX = MousePosition.X - LblCursorX.Width / 2;
            int YY = MousePosition.Y - LblCursorY.Height / 2;

            //bool visible = true;



            ChartArea areas = ChartMain.ChartAreas[0];



            if (PlotVector.IsInvalid || !AMath.InArea(PlotVector, (Point2D)MousePosition))
            {
                return;
            }


            DateTime time = DateTime.FromOADate(CursorPosition.X);
            string   sX   = time.ToString("yyyy-MM-dd HH:mm:ss");
            string   sY   = System.String.Format("{0:N5}", CursorPosition.Y);

            ChartMain.Invoke((MethodInvoker)(() =>
            {
                if (sX != LblCursorX.Text)
                {
                    LblCursorX.Text = sX;
                    LblCursorX.Location = new Point(XX, LblCursorX.Location.Y);
                }

                if (sY != LblCursorY.Text)
                {
                    LblCursorY.Text = sY;
                    LblCursorY.Location = new Point(LblCursorY.Location.X, YY);
                }


                ChartMain.Update();
            }));
        }