public ScaleTickMajor AddTickMajor(double value, bool permanent) { if (this.Range.ScaleType == ScaleType.Log10 && value <= 0.0) { return(null); } if (this.Range.ScaleType == ScaleType.SplitLinearLog10 && value >= this.Range.SplitStart && value <= 0.0) { return(null); } ScaleTickMajor scaleTickMajor = new ScaleTickMajor(); scaleTickMajor.Value = value; scaleTickMajor.Color = this.TickMajor.Color; scaleTickMajor.ForeColor = this.TickMajor.ForeColor; scaleTickMajor.Font = this.TickMajor.Font; scaleTickMajor.Thickness = this.TickMajor.Thickness; scaleTickMajor.Length = this.TickMajor.Length; scaleTickMajor.TextVisible = this.TickMajor.TextVisible; scaleTickMajor.TextMargin = this.TickMajor.TextMargin; scaleTickMajor.Permanent = permanent; if (this.DegreeModeEnabled) { scaleTickMajor.Text = this.TextFormatting.GetText(Math2.AngleNormalized(scaleTickMajor.Value)); } else { scaleTickMajor.Text = this.TextFormatting.GetText(scaleTickMajor.Value); } ((ISubClassBase)scaleTickMajor).AmbientOwner = this; ((IScaleTickBase)scaleTickMajor).Display = this; this.TickList.Add(scaleTickMajor); return(scaleTickMajor); }
public ScaleTickMajor AddTickMajor(double value, string text, bool permanent) { ScaleTickMajor scaleTickMajor = this.AddTickMajor(value, permanent); scaleTickMajor.Text = text; return(scaleTickMajor); }
protected virtual void Generate(PaintArgs p, ScaleTickInfo tickInfo) { if (tickInfo.ScaleType == ScaleType.Log10) { this.GenerateLog10(p, tickInfo); } else { if (tickInfo.ScaleType == ScaleType.Linear) { this.CalculateMajorTicks(tickInfo); } this.m_MinorStepSize = tickInfo.MinorStepSize; tickInfo.Display.MajorIncrement = tickInfo.MajorStepSize; tickInfo.Display.MinorIncrement = tickInfo.MinorStepSize; double num = this.GetStartValue(tickInfo); double stopValue = this.GetStopValue(tickInfo); if (tickInfo.MinorStepSize != 0.0 && num != num + tickInfo.MinorStepSize) { while (true) { if (Math2.InRangeDelta(num, tickInfo.Min - Math.Abs(tickInfo.Max * 1E-14), tickInfo.Max + Math.Abs(tickInfo.Max * 1E-14))) { tickInfo.Display.AddTickMajor(num, false); } if (!(num < stopValue)) { break; } for (int i = 0; i < tickInfo.MinorCount; i++) { num += tickInfo.MinorStepSize; if (Math2.InRangeDelta(num, tickInfo.Min, tickInfo.Max)) { if (tickInfo.MidIncluded && i == tickInfo.MinorCount / 2) { tickInfo.Display.AddTickMid(num, false); } else { tickInfo.Display.AddTickMinor(num, false); } } } num += tickInfo.MinorStepSize; } } else { ScaleTickMajor scaleTickMajor = tickInfo.Display.AddTickMajor(this.Display.Range.Mid, false); scaleTickMajor.Value = this.Display.Range.Mid; scaleTickMajor.Text = "Out of Range"; } } }
protected override void CreateObjects() { base.CreateObjects(); this.m_GeneratorAuto = new ScaleGeneratorAuto(); base.AddSubClass(this.GeneratorAuto); this.m_GeneratorFixed = new ScaleGeneratorFixed(); base.AddSubClass(this.GeneratorFixed); this.m_TickMajor = new ScaleTickMajor(); base.AddSubClass(this.TickMajor); this.m_TickMid = new ScaleTickMid(); base.AddSubClass(this.TickMid); this.m_TickMinor = new ScaleTickMinor(); base.AddSubClass(this.TickMinor); this.TextFormatting = new TextFormatDoubleAll(); ((IScaleGeneratorBase)this.m_GeneratorAuto).Display = this; ((IScaleGeneratorBase)this.m_GeneratorFixed).Display = this; this.m_TickInfo = new ScaleTickInfo(this); ((ISubClassBase)this.TickMajor).ColorAmbientSource = AmbientColorSouce.Color; ((ISubClassBase)this.TickMinor).ColorAmbientSource = AmbientColorSouce.Color; ((ISubClassBase)this.TickMid).ColorAmbientSource = AmbientColorSouce.Color; this.m_MajorIncrement = 10.0; this.m_MinorIncrement = 1.0; base.ColorAmbientSource = AmbientColorSouce.ForeColor; }