internal override IEnumerable <AxisTickModel> GenerateTicks(ValueRange <decimal> currentVisibleRange) { if (this.majorStep <= 0 || this.actualRange.maximum == this.actualRange.minimum) { yield break; } decimal tickStep = (decimal)this.majorStep; decimal normalizedTickStep = tickStep / 360; decimal startTick = 0; decimal endTick = 1; decimal currentTick = startTick; decimal value = 0; while (currentTick < endTick || RadMath.AreClose((double)currentTick, (double)endTick)) { AxisTickModel tick = new MajorTickModel(); tick.normalizedValue = this.IsInverse ? 1 - currentTick : currentTick; tick.value = value; currentTick += normalizedTickStep; value += tickStep; yield return(tick); } }
internal override IEnumerable <AxisTickModel> GenerateTicks(ValueRange <decimal> currentVisibleRange) { // use the decimal type for higher accuracy; see the XML comments on the GetVisibleRange method decimal delta = (decimal)this.actualRange.maximum - (decimal)this.actualRange.minimum; if (delta <= 0) { yield break; } double scale = this.layoutStrategy.GetZoom(); double step = this.majorStep; if (scale != 1d) { step = NumericalAxisModel.NormalizeStep(step / scale); } decimal tickStep = (decimal)step; decimal normalizedTickStep = tickStep / delta; currentVisibleRange.minimum -= currentVisibleRange.minimum % normalizedTickStep; currentVisibleRange.maximum += normalizedTickStep - (currentVisibleRange.maximum % normalizedTickStep); decimal startTick, endTick; if (this.IsInverse) { startTick = Math.Max(0, 1 - currentVisibleRange.maximum); endTick = Math.Min(1, 1 - currentVisibleRange.minimum); } else { startTick = Math.Max(0, currentVisibleRange.minimum); endTick = Math.Min(1, currentVisibleRange.maximum); } decimal currentTick = startTick; decimal value = (decimal)this.actualRange.minimum + currentTick * delta; int virtualIndex = (int)((value - (decimal)this.actualRange.minimum) / tickStep); while (currentTick < endTick || RadMath.AreClose((double)currentTick, (double)endTick)) { AxisTickModel tick = new MajorTickModel(); tick.normalizedValue = this.IsInverse ? 1 - currentTick : currentTick; tick.value = (decimal)this.ReverseTransformValue((double)value); tick.virtualIndex = virtualIndex; currentTick += normalizedTickStep; value += tickStep; virtualIndex++; yield return(tick); } }
internal override IEnumerable <AxisTickModel> GenerateTicks(ValueRange <decimal> currentVisibleRange) { int categoryCount = this.categories.Count; if (categoryCount == 0) { yield break; } int tickInterval = this.GetMajorTickInterval(); int emptyTickCount = 0; int tickCount = categoryCount; decimal tickStep = tickCount == 1 ? 1 : 1m / tickCount; decimal normalizedTickStep = tickStep * 360; decimal startTick = 0; decimal endTick = 1 - tickStep; decimal currentTick = startTick; decimal value = 0; int virtualIndex = (int)(startTick / tickStep); while (currentTick < endTick || RadMath.AreClose((double)currentTick, (double)endTick)) { if (emptyTickCount == 0) { AxisTickModel tick = new MajorTickModel(); tick.normalizedValue = this.IsInverse ? 1 - currentTick : currentTick; tick.value = value; tick.virtualIndex = virtualIndex; emptyTickCount = tickInterval - 1; yield return(tick); } else { emptyTickCount--; } currentTick += tickStep; value += normalizedTickStep; virtualIndex++; } }
internal override IEnumerable <AxisTickModel> GenerateTicks(ValueRange <decimal> currentVisibleRange) { if (!this.CanPlot || !(this.plotInfo.Min < this.plotInfo.Max)) { yield break; } this.UpdateVisibleTicks(currentVisibleRange); decimal plotDelta = this.plotInfo.Max - this.plotInfo.Min; decimal startTicks = Math.Max(0, (this.visibleTicks.minimum - this.plotInfo.Min) / plotDelta); decimal endTicks = Math.Min(1, (this.visibleTicks.maximum - this.plotInfo.Min) / plotDelta); decimal currentTicks = startTicks; decimal paddedCurrentTicks = currentTicks; int virtualIndex = (int)(startTicks * this.values.Count); if (this.actualPlotMode == AxisPlotMode.OnTicksPadded) { decimal nextTicks = this.GetNextTicks(this.plotInfo.Min, this.tickZoomFactor); paddedCurrentTicks += (nextTicks - this.plotInfo.Min) / plotDelta / 2; } while (paddedCurrentTicks < endTicks || RadMath.AreClose((double)paddedCurrentTicks, (double)endTicks)) { MajorTickModel tick = new MajorTickModel(); tick.virtualIndex = virtualIndex; tick.normalizedValue = this.IsInverse ? 1 - paddedCurrentTicks : paddedCurrentTicks; tick.value = this.plotInfo.Min + (currentTicks * plotDelta); decimal nextTicks = this.GetNextTicks(tick.value, this.tickZoomFactor); decimal step = (nextTicks - tick.value) / plotDelta; currentTicks += step; paddedCurrentTicks += step; virtualIndex++; yield return(tick); } }
internal override IEnumerable <AxisTickModel> GenerateTicks(ValueRange <decimal> currentVisibleRange) { // use the decimal type for higher accuracy; see the XML comments on the GetVisibleRange method int categoryCount = this.categories.Count; if (categoryCount == 0) { yield break; } int tickInterval = this.GetMajorTickInterval(); int emptyTickCount = 0; int tickCount = this.actualPlotMode == AxisPlotMode.OnTicks ? categoryCount : categoryCount + 1; decimal tickStep = tickCount == 1 ? 1 : 1m / (tickCount - 1); currentVisibleRange.minimum -= currentVisibleRange.minimum % tickStep; currentVisibleRange.maximum += tickStep - (currentVisibleRange.maximum % tickStep); decimal startTick, endTick; if (this.IsInverse) { startTick = Math.Max(0, 1 - currentVisibleRange.maximum); endTick = Math.Min(1, 1 - currentVisibleRange.minimum); } else { startTick = Math.Max(0, currentVisibleRange.minimum); endTick = Math.Min(1, currentVisibleRange.maximum); } if (this.actualPlotMode == AxisPlotMode.OnTicksPadded) { startTick = tickStep / 2; } decimal currentTick = startTick; int virtualIndex = (int)(startTick / tickStep); while (currentTick < endTick || RadMath.AreClose((double)currentTick, (double)endTick)) { if (emptyTickCount == 0) { AxisTickModel tick = new MajorTickModel(); tick.normalizedValue = this.IsInverse ? 1 - currentTick : currentTick; tick.value = currentTick; tick.virtualIndex = virtualIndex; emptyTickCount = tickInterval - 1; yield return(tick); } else { emptyTickCount--; } currentTick += tickStep; virtualIndex++; } }