Пример #1
0
        /// <summary>
        /// The chart mouse up event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void chartControl1_ChartRegionMouseUp(object sender, Syncfusion.Windows.Forms.Chart.ChartRegionMouseEventArgs e)
        {
            Cursor = Cursors.SizeAll;
            if (this.isDragging)
            {
                double newY = Math.Floor(this.chartControl1.ChartArea.GetValueByPoint(e.Point).YValues[0]);
                double newX = this.chartControl1.ChartArea.GetValueByPoint(e.Point).X;


                if (newY < 0 || newY >= 100 || newX < 0 || newX > 7)
                {
                    MessageBox.Show("Cannot drag outside chart bounds");
                }
                else
                {
                    this.NewYValue(newY);
                    this.NewXValue(newX);
                }

                this.isDragging          = false;
                this.currentRegion       = null;
                this.selectedDataPoint.Y = 0;
                this.selectedDataPoint.X = 0;
                this.chartControl1.Redraw(true);
            }

            this.chartControl1.Series[0].Style.TextFormat = "{0}";
            this.chartControl1.Refresh();
        }
Пример #2
0
        public void splitHorizontal(float split, out ChartRegion top, out ChartRegion bottom)
        {
            // Top region
            top        = this.clone();
            top.Height = split;

            // Bottom region
            bottom         = this.clone();
            bottom.Top    += split;
            bottom.Height -= split;
        }
Пример #3
0
 /// <summary>
 /// The chart mouse down event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void chartControl1_ChartRegionMouseDown(object sender, Syncfusion.Windows.Forms.Chart.ChartRegionMouseEventArgs e)
 {
     selectedDataPoint = new System.Drawing.Point();
     if (e.Region.Type == ChartRegionType.SeriesPoint)
     {
         selectedDataPoint  = e.Point;
         this.Cursor        = Cursors.SizeAll;
         this.isDragging    = true;
         this.currentRegion = e.Region;
     }
 }
Пример #4
0
 private void chartControl1_ChartRegionMouseMove(object sender, Syncfusion.Windows.Forms.Chart.ChartRegionMouseEventArgs e)
 {
     if (e.Region.Type == ChartRegionType.SeriesPoint)
     {
         this.isDragging    = true;
         this.currentRegion = e.Region;
         this.Cursor        = Cursors.SizeAll;
     }
     else
     {
         if (this.selectedDataPoint.X == 0 && this.selectedDataPoint.Y == 0)
         {
             this.Cursor = Cursors.Default;
         }
     }
 }
Пример #5
0
        public void splitAxes(float split, out ChartRegion chart, out ChartRegion x_axis, out ChartRegion y1_axis, out ChartRegion y2_axis)
        {
            chart          = this.clone();
            chart._left   += split;
            chart._width  -= 2 * split;
            chart._height -= split;

            x_axis         = this.clone();
            x_axis._left  += split;
            x_axis._width -= 2 * split;
            x_axis._top    = this._top + this._height - split;
            x_axis._height = split;

            y1_axis          = this.clone();
            y1_axis._width   = split;
            y1_axis._height -= split;

            y2_axis          = this.clone();
            y2_axis._left    = this._left + this._width - split;
            y2_axis._width   = split;
            y2_axis._height -= split;
        }