internal bool ComputeScale(SimpleLineChart trigger) { bool changed = false; ChartScaleInfo combined = null; int index = this.scaleIndex; // make sure they are all up to date. foreach (var ptr in FindCharts()) { ChartScaleInfo info = ptr.ComputeScaleSelf(index); if (combined == null) { combined = info; } else { combined.Combine(info); } } foreach (var ptr in FindCharts()) { if (ptr.ApplyScale(combined)) { if (ptr != trigger) { ptr.DelayedUpdate(); } changed = true; } } return(changed); }
/// <summary> /// Returns true if the scale just changed. /// </summary> bool ComputeScale() { bool changed = false; if (this.Next != null) { ChartScaleInfo combined = null; int index = this.scaleIndex; // make sure they are all up to date. foreach (var ptr in GroupItems) { ChartScaleInfo info = ptr.ComputeScaleSelf(index); if (combined == null) { combined = info; } else { combined.Combine(info); } } //Debug.WriteLine("Combined scale: minx={0}, maxx={1}, miny={2}, maxy={3}", combined.minX, combined.maxX, combined.minY, combined.maxY); foreach (var ptr in GroupItems) { if (ptr.ApplyScale(combined)) { if (ptr != this) { ptr.DelayedUpdate(); } changed = true; } } } else { ChartScaleInfo info = ComputeScaleSelf(this.scaleIndex); changed = ApplyScale(info); } return(changed); }