Example #1
0
        void ChartMain_MouseLeave(object sender, EventArgs e)
        {
            if (ChartMain.Focused)
            {
                ChartMain.Parent.Focus();
            }

            MouseVector.Reset();
        }
Example #2
0
        /// <summary>
        /// Moves chart around depending on
        /// </summary>
        /// <param name="e"></param>
        private void MoveX(MouseEventArgs e)
        {
            if (MouseVector.Start.IsInvalid)
            {
                return;
            }

            MouseVector.End = (Point2D)e.Location;

            if (MouseVector.IsInvalid ||
                MouseVector.Min < 0 ||
                MouseVector.MaxX >= ChartMain.Width ||
                MouseVector.MaxY >= ChartMain.Height ||
                MouseVector.Width < 1
                )
            {
                return;
            }


            double position = ChartMain.ChartAreas[0].AxisX.ScaleView.Position;
            double size     = ChartMain.ChartAreas[0].AxisX.ScaleView.Size;

            double x1   = AxisX.PixelPositionToValue(MouseVector.Start.X);
            double x2   = AxisX.PixelPositionToValue(MouseVector.End.X);
            double move = x2 - x1;

            double pXStart = position - move;
            double pXEnd   = position + size;


            if (MinX == null || MaxX == null)
            {
                return;
            }

            if ((pXStart < MinX.XValue && move > 0) || (pXEnd > MaxX.XValue && move < 0))
            {
                MouseVector.Reset();
                return;
            }


            //ScaleX.Zoom(pXStart, pXEnd);

            ChartMain.ChartAreas[0].AxisX.ScaleView.Position = pXStart;
            //ChartMain.ChartAreas[0].AxisX.ScaleView.Size = pXEnd - pXStart;



            this.RescaleY();
            MouseVector.Start = MouseVector.End;
        }
Example #3
0
 void ChartMain_MouseUp(object sender, MouseEventArgs e)
 {
     MouseVector.Reset();
 }
Example #4
0
 void ChartMain_MouseDown(object sender, MouseEventArgs e)
 {
     MouseVector.Reset();
     MouseVector.Start = (Point2D)e.Location;
 }