private IEnumerable <ScalePosition> Project(IList <Category> categories, NumericSequence sequence, double interval) { this.RecalculateIfEmpty(); Range <double> fromRange = new Range <double>(this.ActualViewMinimum, this.ActualViewMaximum); Category category = (Category)null; foreach (DoubleR10 doubleR10 in sequence) { double x = (double)doubleR10; int index = (int)Math.Floor(x) - this._minLeafIndex; if (index >= 0 && index < categories.Count) { category = categories[index]; double bucketMinX = (double)(this._minLeafIndex + category.LeafIndexRange.Minimum); double bucketMaxX = (double)(this._minLeafIndex + category.LeafIndexRange.Maximum); yield return(new ScalePosition(category.Content, RangeHelper.Project(fromRange, x, Scale.PercentRange), RangeHelper.Project(fromRange, bucketMinX, Scale.PercentRange), RangeHelper.Project(fromRange, bucketMaxX, Scale.PercentRange))); } if (sequence == this._majorSequence && category != null && index == categories.Count) { double bucketMinX = Math.Floor(x); double bucketMaxX = bucketMinX; yield return(new ScalePosition(category.Content, RangeHelper.Project(fromRange, x, Scale.PercentRange), RangeHelper.Project(fromRange, bucketMinX, Scale.PercentRange), RangeHelper.Project(fromRange, bucketMaxX, Scale.PercentRange))); } } }
private IEnumerable <ScalePosition> ProjectMajor(IList <Category> categories, ScaleElementDefinition definition) { this.RecalculateIfEmpty(); int maxCount = this.MaxCount * 2; if (categories.Count <= maxCount || categories.Count <= 50) { Range <double> fromRange = new Range <double>(this.ActualViewMinimum, this.ActualViewMaximum); Category lastCategory = (Category)null; foreach (Category category in (IEnumerable <Category>)categories) { double bucketMinX = (double)(this._minLeafIndex + category.LeafIndexRange.Minimum); double bucketMaxX = (double)(this._minLeafIndex + category.LeafIndexRange.Maximum); double x = bucketMinX; yield return(new ScalePosition(category.Content, RangeHelper.Project(fromRange, x, Scale.PercentRange), RangeHelper.Project(fromRange, bucketMinX, Scale.PercentRange), RangeHelper.Project(fromRange, bucketMaxX, Scale.PercentRange))); lastCategory = category; } if (lastCategory != null) { double x = (double)(this._minLeafIndex + lastCategory.LeafIndexRange.Maximum); double projectedX = RangeHelper.Project(fromRange, x, Scale.PercentRange); yield return(new ScalePosition((object)string.Empty, projectedX, projectedX, projectedX)); } } }
internal double ProjectSizeToPixels(DataPoint dataPoint, double value) { BubbleDataPoint bubbleDataPoint = dataPoint as BubbleDataPoint; if (!this.BubbleSeries.IsSizeValueUsed || bubbleDataPoint == null || !bubbleDataPoint.IsSizeValueUsed) { return(dataPoint.MarkerSize); } if (!this.BubbleSeries.ActualSizeDataRange.HasData) { return(0.0); } Range <double> range = new Range <double>(ValueHelper.ToDouble((object)this.BubbleSeries.ActualSizeDataRange.Minimum), ValueHelper.ToDouble((object)this.BubbleSeries.ActualSizeDataRange.Maximum)); double num = this.BubblePixelAreaSizeRange.Maximum; if (RangeHelper.Size(range) != 0.0) { value = Math.Min(Math.Max(value, range.Minimum), range.Maximum); num = RangeHelper.Project(range, value, this.BubblePixelAreaSizeRange); } if (this.BubbleSeries.BubbleMarkerSizeRangeUnitType == BubbleSizeRangeUnitType.Relative) { num = 2.0 * Math.Sqrt(num / Math.PI); } return(num); }
public virtual double ConvertScaleToAxisUnits(double value, double axisLength) { value = RangeHelper.Project(AxisPresenter.DefaultScaleRange, value, this.ActualScaleRange); if (this.ActualIsScaleReversed) { return(axisLength - axisLength * value); } return(axisLength * value); }
public override void ZoomBy(double centerValue, double ratio) { this.BoxZoomRatio(ref ratio, this.ConvertActualViewToPercent()); Range <long> targetRange = new Range <long>(this.ActualViewMinimum.Ticks, this.ActualViewMaximum.Ticks); long num1 = RangeHelper.Project(Scale.PercentRange, centerValue, targetRange); Decimal num2 = (Decimal)ratio; this.ZoomToValue(new DateTime((long)Math.Round((Decimal)num1 - (Decimal)(num1 - targetRange.Minimum) / num2)), new DateTime((long)Math.Round((Decimal)num1 + (Decimal)(targetRange.Maximum - num1) / num2))); }
public override void ZoomToPercent(double viewMinimum, double viewMaximum) { double minSize = 1.0 / this.ActualZoomRange.Maximum; double maxSize = 1.0 / this.ActualZoomRange.Minimum; RangeHelper.BoxRangeInsideAnother(ref viewMinimum, ref viewMaximum, 0.0, 1.0, minSize, maxSize, 0.01); Range <double> targetRange = new Range <double>(this.ActualMinimum, this.ActualMaximum); this.ZoomToValue(RangeHelper.Project(Scale.PercentRange, viewMinimum, targetRange), RangeHelper.Project(Scale.PercentRange, viewMaximum, targetRange)); }
public override double ProjectDataValue(object value) { double num = this.ConvertToPositionType(value); if (num < this.ActualMinimum || num > this.ActualMaximum) { return(double.NaN); } return(RangeHelper.Project(new Range <double>(this.ActualViewMinimum, this.ActualViewMaximum), num + 0.5, Scale.PercentRange)); }
private IEnumerable <ScalePosition> ProjectLabels(LabelDefinition element, NumericScaleUnit defaultUnit) { this.RecalculateIfEmpty(); NumericSequence sequence = this.CalculateElementSequence((ScaleElementDefinition)element, defaultUnit); Range <double> fromRange = new Range <double>(this.ActualViewMinimum, this.ActualViewMaximum); foreach (DoubleR10 doubleR10 in sequence) { double x = (double)doubleR10; yield return(new ScalePosition((object)x, RangeHelper.Project(fromRange, x, Scale.PercentRange))); } }
public override IEnumerable <double> ProjectValues(IEnumerable values) { if (values != null) { Range <double> fromRange = new Range <double>(this.ActualViewMinimum, this.ActualViewMaximum); foreach (object obj in values) { double x = this.ConvertToPositionType(obj); yield return(RangeHelper.Project(fromRange, x, Scale.PercentRange)); } } }
private IEnumerable <ScalePosition> ProjectMinor(IList <Category> categories, ScaleElementDefinition definition, int level) { this.RecalculateIfEmpty(); int step = 1; int maxCount = this.MaxCount; if (categories.Count > maxCount && categories.Count > 50) { if (level != this._realizedCategoryLevels.Count - 1) { yield break; } else { switch (maxCount) { case 0: yield break; case 1: yield break; case 2: step = categories.Count - 1; break; default: step = categories.Count / (maxCount - 1); if (categories.Count % maxCount != 0) { step = (int)Math.Ceiling((double)categories.Count / ((double)maxCount - 2.0)); break; } break; } } } Range <double> fromRange = new Range <double>(this.ActualViewMinimum, this.ActualViewMaximum); int i = 0; while (i < categories.Count) { Category category = categories[i]; double bucketMinX = (double)(this._minLeafIndex + category.LeafIndexRange.Minimum); double bucketMaxX = (double)(this._minLeafIndex + category.LeafIndexRange.Maximum); double x = (bucketMaxX + bucketMinX) / 2.0; yield return(new ScalePosition(category.Content, RangeHelper.Project(fromRange, x, Scale.PercentRange), RangeHelper.Project(fromRange, bucketMinX, Scale.PercentRange), RangeHelper.Project(fromRange, bucketMaxX, Scale.PercentRange))); i += step; } }
public override IEnumerable <double> ProjectValues(IEnumerable values) { this.RecalculateIfEmpty(); if (values != null) { Range <double> fromRange = new Range <double>((double)this.ActualViewMinimum.Ticks, (double)this.ActualViewMaximum.Ticks); foreach (object obj in values) { DateTime time = this.ConvertToPositionType(obj); double x = (double)time.Ticks; yield return(RangeHelper.Project(fromRange, x, Scale.PercentRange)); } } }
public override double ConvertToPercent(object value) { if (value == null) { return(double.NaN); } this.RecalculateIfEmpty(); Range <double> fromRange = new Range <double>(this.ActualMinimum, this.ActualMaximum); double num = Convert.ToDouble(value, (IFormatProvider)CultureInfo.InvariantCulture); if (DoubleHelper.LessWithPrecision(num, fromRange.Minimum) || DoubleHelper.GreaterWithPrecision(num, fromRange.Maximum)) { return(double.NaN); } return(RangeHelper.Project(fromRange, num, Scale.PercentRange)); }
public override double ConvertToPercent(object value) { if (value == null) { return(double.NaN); } this.RecalculateIfEmpty(); Range <long> fromRange = new Range <long>(this.ActualMinimum.Ticks, this.ActualMaximum.Ticks); long ticks = this.ConvertToPositionType(value).Ticks; if (ticks < fromRange.Minimum || ticks > fromRange.Maximum) { return(double.NaN); } return(RangeHelper.Project(fromRange, ticks, Scale.PercentRange)); }
public override double ConvertToPercent(object value) { if (value == null) { return(double.NaN); } double num = Convert.ToDouble(value, (IFormatProvider)CultureInfo.InvariantCulture); Range <double> fromRange = new Range <double>(this.ActualMinimum, this.ActualMaximum); double precision1 = DoubleHelper.GetPrecision(num, fromRange.Minimum, fromRange.Maximum); if (DoubleHelper.LessWithPrecision(num, fromRange.Minimum, precision1) || DoubleHelper.GreaterWithPrecision(num, fromRange.Maximum, precision1)) { return(double.NaN); } double precision2 = DoubleHelper.GetPrecision(1, new double[0]); return(DoubleHelper.RoundWithPrecision(RangeHelper.Project(fromRange, num, Scale.PercentRange), precision2)); }
public override IEnumerable <double> ProjectValues(IEnumerable values) { this.RecalculateIfEmpty(); if (values != null) { Range <double> fromRange = new Range <double>(this.ActualViewMinimum, this.ActualViewMaximum); foreach (object obj in values) { double x = this.ConvertToPositionType(obj); if (x < 0.0) { yield return(double.NaN); } else { yield return(RangeHelper.Project(fromRange, x + 0.5, Scale.PercentRange)); } } } }
private double TransformYValueInScaleUnits(XYDataPoint dataPoint, double yValueInScaleUnits) { if (!this.IsHundredPercent(dataPoint)) { return(yValueInScaleUnits); } Range <IComparable> pointYvalueRange = this.GetDataPointYValueRange(dataPoint); double val2 = (double)ValueHelper.ConvertValue((object)pointYvalueRange.Minimum, DataValueType.Float); double num = Math.Max(0.0, (double)ValueHelper.ConvertValue((object)pointYvalueRange.Maximum, DataValueType.Float)) - Math.Min(0.0, val2); NumericScale numericScale = this.Series.YAxis.Scale as NumericScale; if (num == 0.0) { return(this.Series.YAxis.Scale.ProjectDataValue(this.Series.YAxis.Scale.ActualCrossingPosition)); } Range <double> fromRange = new Range <double>(numericScale.Project(0.0), numericScale.Project(num)); Range <double> targetRange = new Range <double>(numericScale.Project(0.0), numericScale.Project(1.0)); return(RangeHelper.Project(fromRange, yValueInScaleUnits, targetRange)); }
internal virtual double ConvertProjectedValueToPercent(double value) { return(RangeHelper.Project(new Range <double>(this.Project(this.ActualMinimum), this.Project(this.ActualMaximum)), value, Scale.PercentRange)); }
public override void ScrollToPercent(double viewPosition) { Range <double> targetRange = new Range <double>(this.ActualMinimum, this.ActualMaximum); this.ScrollToValue(RangeHelper.Project(Scale.PercentRange, viewPosition, targetRange)); }
public override double Project(double value) { return(RangeHelper.Project(new Range <double>(this.ActualViewMinimum, this.ActualViewMaximum), value, Scale.PercentRange)); }
public override void ScrollToPercent(double position) { Range <long> targetRange = new Range <long>(this.ActualMinimum.Ticks, this.ActualMaximum.Ticks); this.ScrollToValue(new DateTime(RangeHelper.Project(Scale.PercentRange, position, targetRange))); }
public override double Project(DateTime value) { this.RecalculateIfEmpty(); return(RangeHelper.Project(new Range <long>(this.ActualViewMinimum.Ticks, this.ActualViewMaximum.Ticks), value.Ticks, Scale.PercentRange)); }
public virtual double ConvertAxisToScaleUnits(double value, double axisLength) { return(RangeHelper.Project(this.ActualScaleRange, value, AxisPresenter.DefaultScaleRange)); }