コード例 #1
0
 /// <summary>
 /// Gets the range of {x, y} plot coordinates that corresponds to all the markers shown on the plot.
 /// </summary>
 /// <returns></returns>
 protected override DataRect ComputeBounds()
 {
     if (!areContentBoundsValid)
     {
         IValueConverter boundsConverter = GetDataBoundsConverter(MarkerTemplate);
         SyncMarkerViewModels();
         DataRect[] rects = new DataRect[models.Count];
         for (int i = 0; i < models.Count; i++)
         {
             rects[i] = (DataRect)boundsConverter.Convert(models[i], typeof(DataRect), null, CultureInfo.InvariantCulture);
         }
         DataRect union = rects.Length > 0 ? rects[0] : new DataRect(-0.5, -0.5, 0.5, 0.5);
         for (int i = 1; i < rects.Length; i++)
         {
             union.Surround(rects[i]);
         }
         if (union.XMax == union.XMin)
         {
             union = new DataRect(union.XMin - 0.5, union.YMin, union.XMin - 0.5 + union.Width + 1.0, union.YMin + union.Height);
         }
         if (union.YMax == union.YMin)
         {
             union = new DataRect(union.XMin, union.YMin - 0.5, union.XMin + union.Width, union.YMin - 0.5 + union.Height + 1.0);
         }
         localPlotBounds       = union;
         areContentBoundsValid = true;
     }
     return(localPlotBounds);
 }
コード例 #2
0
        /// <summary>
        /// Computes minimal plot rectangle which contains plot rectangles of current <see cref="PlotBase"/> instance and of all child <see cref="PlotBase"/> instances
        /// </summary>
        /// <returns>Minimal plot rectangle which contains plot rectangles of current <see cref="PlotBase"/> instance and of all child <see cref="PlotBase"/> instances</returns>
        protected DataRect AggregateBounds()
        {
            DataRect result = ComputeBounds();

            foreach (var item in dependantsField)
            {
                result.Surround(item.AggregateBounds());
            }

            return(result);
        }