Example #1
0
        /// <summary>
        /// Gets the boundaries (top, left, bottom, right) of this chart's visible
        /// data in the same units as the data. The ZoomChanged callback provides
        /// the same data.
        /// </summary>
        /// <param name="ptrChart">The chart.</param>
        /// <returns>Boundaries (<see cref="ChartExtents"/>) of the chart.</returns>
        public static ChartExtents GetBoundariesOfVisibleData(this Chart ptrChart)
        {
            if (ptrChart.ChartAreas.Count < 1)
            {
                throw new InvalidOperationException("Missing chart area");
            }
            ChartArea    ptrChartArea = ptrChart.ChartAreas[0];
            ChartExtents extents      = ExtentsFromCurrentView(ptrChartArea);

            return(extents);
        }
Example #2
0
        private static ChartExtents ExtentsFromDataCoordinates(double left, double top, double right,
                                                               double bottom)
        {
//NOTE: Height needs to be negative because we always
            //  specify the *top* left corner
            var rect = new RectangleF((float)left, (float)top,
                                      (float)(right - left), (float)(bottom - top));
            var extents = new ChartExtents
            {
                PrimaryExtents = rect
            };

            return(extents);
        }
Example #3
0
 private void ZoomChanged(ChartExtents extents)
 {
     RectangleF e = extents.PrimaryExtents;
     lblZoomExtents.Text = string.Format(ZoomChangedDisplayFormatLeftRightTopBottom,
         e.Left, e.Right, e.Top, e.Bottom);
 }
 private static ChartExtents ExtentsFromDataCoordinates(double left, double top, double right,
     double bottom)
 {
     //NOTE: Height needs to be negative because we always
     //  specify the *top* left corner
     var rect = new RectangleF((float) left, (float) top,
                               (float) (right - left), (float) (bottom - top));
     var extents = new ChartExtents
         {
             PrimaryExtents = rect
         };
     return extents;
 }