private static PlotModel RangeColorAxis(AxisPosition position) { int n = 1000; var model = new PlotModel { Title = string.Format("ScatterSeries and RangeColorAxis (n={0})", n), Background = OxyColors.LightGray }; model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom }); model.Axes.Add(new LinearAxis { Position = AxisPosition.Left }); var rca = new RangeColorAxis { Position = position, Maximum = 2, Minimum = -2 }; rca.AddRange(0, 0.5, OxyColors.Blue); rca.AddRange(-0.2, -0.1, OxyColors.Red); model.Axes.Add(rca); var s1 = new ScatterSeries { MarkerType = MarkerType.Square, MarkerSize = 6, }; var random = new Random(13); for (int i = 0; i < n; i++) { double x = (random.NextDouble() * 2.2) - 1.1; s1.Points.Add(new ScatterPoint(x, random.NextDouble()) { Value = x }); } model.Series.Add(s1); return model; }
/// <summary> /// Set the axis maximum for the nth graph in each graph tab. /// </summary> /// <param name="axisType">The type of axis to be modified.</param> /// <param name="graphIndex">The index of the graph in each tab to be modified.</param> /// <param name="value">The new axis maximum value.</param> private void SetAxisMax(AxisPosition axisType, int graphIndex, double value) { foreach (GraphView view in GetGraphViews(graphIndex)) { view.SetAxisMax(value, axisType); } }
public Axis(AxisPosition pos, double minimum, double maximum) : this() { Position = pos; Minimum = minimum; Maximum = maximum; }
public void AddAxis(Axis ax, AxisPosition position) { ax.Owner = this; ax.Position = position; axis.Add(ax); QueueDraw(); }
private void SetDefaults() { COMPort = "COM3"; BaudRate = BaudRate.Baud9600; Timeout = TimeOutOption.TO2000; Retry = RetryOption.Once; RefreshInterval = 250; PolarSlopeBrightness = 125; CustomTrackingRate = new double[] { 0.0D, 0.0D }; AscomCompliance = new AscomCompliance(); AxisParkPosition = new AxisPosition(0.0, 0.0); AxisUnparkPosition = new AxisPosition(0.0, 0.0); CustomTrackingRate = new double[] { 0.0, 0.0 }; TrackingState = TrackingStatus.Off; TrackingRate = DriveRates.driveSidereal; DriveRateValue = new Dictionary <DriveRates, double> { { DriveRates.driveSidereal, CoreConstants.SIDEREAL_RATE_ARCSECS }, { DriveRates.driveLunar, CoreConstants.LUNAR_RATE_ARCSECS }, { DriveRates.driveSolar, CoreConstants.SOLAR_RATE_ARCSECS }, { DriveRates.driveKing, CoreConstants.KING_RATE_ARCSECS } }; GuideRateDeclination = 0.0; // Degrees/Sec GuideRateRightAscension = 0.0; // Degrees/Sec GuideRateDeclinationMin = 0.0; // Degrees/Sec GuideRateDeclinationMax = 10.0; // Degrees/Sec GuideRateRightAscensionMin = 0.0; // Degrees/Sec GuideRateRightAscensionMax = 10.0; // Degrees/Sec PulseGuidingInterval = 20; // Milliseconds }
public void ConvertVisonToObject(string json) { ///反序列化 BpHead head = Bp.Mes.Handle.Instance.JsonstringToObj(json); string type = head.type.Remove(0, 7); Enum.TryParse(type, out CommandType type1); object obj = head.obj; switch (type1) { case CommandType.CapturePosition: break; case CommandType.AxisPosition: AxisPosition pose = obj as AxisPosition; ReportAxisPosition(pose.CaptureId); break; case CommandType.AxisOffset: AddVisionResultToList(obj as AxisOffset); _visionResponseManualResetEvent.Set(); break; default: throw new NotImplementedException("Vison command type error"); } }
private LogarithmicAxis CreateNewLogAxis(string title, AxisPosition axpos) { if (!IsGeneratingPlotsForReporting) { var newAxis = new LogarithmicAxis { Position = axpos, Title = title }; if (axpos == AxisPosition.Right) { newAxis.Key = _rightAxisKey; } return(newAxis); } else { var newAxis = new LogarithmicAxis { Position = axpos, Title = title }; if (axpos == AxisPosition.Right) { newAxis.Key = _rightAxisKey; } return(newAxis); } }
/// <summary> /// Ensure the specified X exists. Uses the 'DataType' property of the DataColumn /// to determine the type of axis. /// </summary> /// <param name="axisType">The axis type to check</param> /// <param name="dataType">The data type of the axis</param> private void EnsureAxisExists(Models.Graph.Axis.AxisType axisType, Type dataType) { // Make sure we have an x axis at the correct position. if (this.GetAxis(axisType) == null) { AxisPosition position = this.AxisTypeToPosition(axisType); OxyPlot.Axes.Axis axisToAdd; if (dataType == typeof(DateTime)) { axisToAdd = new DateTimeAxis(); } else if (dataType == typeof(double)) { axisToAdd = new LinearAxis(); } else { axisToAdd = new CategoryAxis(); } axisToAdd.Position = position; axisToAdd.Key = axisType.ToString(); this.plot1.Model.Axes.Add(axisToAdd); } }
private void AddAlignmentPoint(double[] mountAltAz, double[] observedAltAz, AxisPosition mountAxes, AxisPosition observedAxes, PierSide pierSide, DateTime syncTime) { lock (_accessLock) { if (AlignmentPoints.Count > 2 && ProximityLimit > 0.0) { // Remove any existing alignment points that are too close to the new one. var nearPoints = AlignmentPoints .Where(p => p.MountAxes.IncludedAngleTo(mountAxes) <= ProximityLimit).ToList(); foreach (AlignmentPoint deletePt in nearPoints) { AlignmentPoints.Remove(deletePt); } } CarteseanCoordinate mountXy = AltAzToCartesean(mountAltAz); CarteseanCoordinate observedXy = AltAzToCartesean(observedAltAz); AlignmentPoints.Add(new AlignmentPoint(observedAltAz, mountAxes, observedAxes, mountXy, observedXy, pierSide, syncTime)); _currentChecksum = int.MinValue; // Reset checksum so that offsets are recalculated OneStarAdjustment[0] = observedAxes[0] - mountAxes[0]; OneStarAdjustment[1] = observedAxes[1] - mountAxes[1]; SaveAlignmentPoints(); } }
public void TakiExample5_4_4() { using (AscomTools tools = new AscomTools()) { Angle longitude = new Angle("-1°20'20.54\""); tools.Transform.SiteLatitude = new Angle("52°40'6.38\""); tools.Transform.SiteLongitude = longitude; tools.Transform.SiteElevation = 175.5; DateTime initialTime = new DateTime(2017, 03, 28, 21, 0, 0); DateTime observationTime = new DateTime(2017, 03, 28, 21, 27, 56); MountCoordinate star1 = new MountCoordinate(new EquatorialCoordinate("0h7m54.0s", "29.038°"), new AxisPosition(1.732239, 1.463808, true), tools, observationTime); observationTime = new DateTime(2017, 03, 28, 21, 37, 02); MountCoordinate star2 = new MountCoordinate(new EquatorialCoordinate("2h21m45.0s", "89.222°"), new AxisPosition(5.427625, 0.611563, true), tools, observationTime); TakiEQMountMapper taki = new TakiEQMountMapper(star1, star2, initialTime); EquatorialCoordinate bCet = new EquatorialCoordinate("0h43m07s", "-18.038°"); DateTime targetTime = new DateTime(2017, 03, 28, 21, 52, 12); AxisPosition bCetExpected = new AxisPosition(2.27695654215, 0.657465529226, true); // 130.46°, 37.67° AxisPosition bCetCalculated = taki.GetAxisPosition(bCet, targetTime); System.Diagnostics.Debug.WriteLine("Expected: {0}, calculated: {1}", bCetExpected, bCetCalculated); double tolerance = 0.5; // degrees. bool testResult = ((Math.Abs(bCetExpected.DecAxis - bCetCalculated.DecAxis) < tolerance) && (Math.Abs(bCetExpected.RAAxis - bCetCalculated.RAAxis) < tolerance)); Assert.IsTrue(testResult); } }
public static PlotModel CreateRandomScatterSeriesWithColorAxisPlotModel(int n, OxyPalette palette, MarkerType markerType // = MarkerType.Square , AxisPosition colorAxisPosition // = AxisPosition.Right , OxyColor highColor // = null , OxyColor lowColor) // = null) { var model = new PlotModel(string.Format("ScatterSeries (n={0})", n)) { Background = OxyColors.LightGray }; model.Axes.Add(new ColorAxis { Position = colorAxisPosition, Palette = palette, Minimum = -1, Maximum = 1, HighColor = highColor, LowColor = lowColor }); var s1 = new ScatterSeries { MarkerType = markerType, MarkerSize = 6, }; var random = new Random(); for (int i = 0; i < n; i++) { double x = random.NextDouble() * 2.2 - 1.1; s1.Points.Add(new ScatterPoint(x, random.NextDouble()) { Value = x }); } model.Series.Add(s1); return(model); }
/// <summary> /// このイベント引数の新しいインスタンスを初期化します。 /// </summary> /// <param name="ticks"></param> internal AxisChangedEventArgs(AxisPosition position, double oneSize, double minimum, double totalAxisSize) : base() { this.Position = position; this.OneSize = oneSize; this.Minimum = minimum; this.TotalAxisSize = totalAxisSize; }
private void UpdateChart() { cartesianChart1.Visible = false; int seriescount = 0; cartesianChart1.AxisX.Clear(); cartesianChart1.AxisX.Add(new Axis { Title = "Time (s)" }); cartesianChart1.AxisY.Clear(); cartesianChart1.Series.Clear(); cartesianChart1.Zoom = ZoomingOptions.X; cartesianChart1.DisableAnimations = true; for (int i = 0; i < fieldlist.Count; i++) { bool st = Convert.ToBoolean(dataGridView1.Rows[i].Cells[0].Value); if (st) { Series s = serieslist[i]; AxisPosition ap = ((seriescount & 1) == 0) ? AxisPosition.RightTop : AxisPosition.LeftBottom; cartesianChart1.AxisY.Add(new Axis { Title = fieldlist[i], Position = ap, Foreground = brushpallette[seriescount % brushpallette.Length] }); s.Stroke = brushpallette[seriescount % brushpallette.Length]; s.ScalesYAt = seriescount; cartesianChart1.Series.Add(s); seriescount++; } cartesianChart1.Visible = true; } }
private void SlewToEquatorialCoordinate(double rightAscension, double declination) { lock (Controller) { TargetRightAscension = rightAscension; TargetDeclination = declination; LogMessage("SlewToCoordinates", "RA:{0}/Dec:{1}", _AscomToolsCurrentPosition.Util.HoursToHMS(rightAscension, "h", "m", "s"), _AscomToolsCurrentPosition.Util.DegreesToDMS(declination, ":", ":")); DateTime currentTime = DateTime.Now; Controller.MCAxisStop(AxisId.Both_Axes); // Stop the axes moving to get distances AxisPosition currentAxisPosition = _CurrentPosition.ObservedAxes; AxisPosition targetAxisPosition = _CurrentPosition.GetAxisPositionForRADec(rightAscension, declination, _AscomToolsCurrentPosition); double slewSeconds = Controller.MCGetSlewTimeEstimate(targetAxisPosition, Hemisphere); // Get a refined target position allowing for slew time. targetAxisPosition = _CurrentPosition.GetAxisPositionForRADec(rightAscension, declination, _AscomToolsCurrentPosition, slewSeconds); _TargetPosition = new MountCoordinate(targetAxisPosition, _AscomToolsTargetPosition, currentTime); System.Diagnostics.Debug.WriteLine($"Current Physical SOP: { currentAxisPosition.PhysicalSideOfPier}\t\tPointing SOP: {_CurrentPosition.GetPointingSideOfPier(false)}"); System.Diagnostics.Debug.WriteLine($" Target Physical SOP: { targetAxisPosition.PhysicalSideOfPier}\t\tPointing SOP: {_TargetPosition.GetPointingSideOfPier(false)}"); System.Diagnostics.Debug.WriteLine($" PreviousAxisPosition: { _previousAxisPosition}\t\tPrevious DecFlipped: {_previousAxisPosition.DecFlipped}"); System.Diagnostics.Debug.WriteLine($" Previous Pointing SOP: { _previousPointingSOP}\t\tPrevious DecFlipped: {_previousAxisPosition.DecFlipped}"); _IsSlewing = true; Controller.MCAxisSlewTo(targetAxisPosition, Hemisphere); } }
/// <summary> /// このイベント引数の新しいインスタンスを初期化します。 /// </summary> /// <param name="ticks"></param> internal AxisTickChangedEventArgs(IEnumerable <AxisTickModel> ticks, AxisPosition position, double totalAxisSize, double tickAreaSize, bool isShowTick) : base() { this.Ticks = ticks; this.Position = position; this.TotalAxisSize = totalAxisSize; this.TickAreaSize = tickAreaSize; this.IsShowTick = isShowTick; }
public LinearAxis(AxisPosition position, double minimum, double maximum, double majorStep, double minorStep, string title = null) : this(position, title) { this.Minimum = minimum; this.Maximum = maximum; this.MajorStep = majorStep; this.MinorStep = minorStep; }
private PierSide GetDestinationSideOfPier(double rightAscension, double declination) { DateTime currentTime = DateTime.Now; AxisPosition targetAxisPosition = _CurrentPosition.GetAxisPositionForRADec(rightAscension, declination, _AscomToolsCurrentPosition); MountCoordinate targetPosition = new MountCoordinate(targetAxisPosition, _AscomToolsTargetPosition, currentTime); return(targetPosition.PointingSideOfPier); }
public LogarithmicAxis(AxisPosition position, string title = null, double minimum = double.NaN, double maximum = double.NaN) : this() { this.Position = position; this.Title = title; this.Minimum = minimum; this.Maximum = maximum; }
public void RoundTripSphericalPolarTests(double alt, double az) { AxisPosition axes = new AxisPosition(az, alt); SphericalCoordinate spherical1 = model.AxesToSpherical(new double[] { az, alt }, timeRecord); AxisPosition outAxes = model.SphericalToAxes(spherical1, timeRecord, spherical1.WeightsDown); Assert.IsTrue(outAxes.Equals(axes, tolerance)); }
public void TestFlip(double a1_0, double a1_1, double e_0, double e_1) { AxisPosition pos1 = new AxisPosition(a1_0, a1_1); AxisPosition expected = new AxisPosition(e_0, e_1); AxisPosition result = pos1.Flip(); Assert.AreEqual(expected, result); }
private static PlotModel CreateRandomScatterSeriesWithColorAxisPlotModel(int n, OxyPalette palette, MarkerType markerType, AxisPosition colorAxisPosition, OxyColor highColor, OxyColor lowColor) { var model = new PlotModel { Title = string.Format("ScatterSeries (n={0})", n), Background = OxyColors.LightGray }; var colorAxis = new LinearColorAxis { Position = colorAxisPosition, Palette = palette, Minimum = -1, Maximum = 1, HighColor = highColor, LowColor = lowColor }; model.Axes.Add(colorAxis); model.Series.Add(CreateRandomScatterSeries(n, markerType, false, true, colorAxis)); return model; }
private AlignmentPoint[] GetNearestObservedPoints(AxisPosition axisPosition, PierSide pierSide, int numberOfPoints, out int checkSum) { AlignmentPoint[] points = AlignmentPoints .Where(p => p.PierSide == pierSide && p.ObservedAxes.IncludedAngleTo(axisPosition) <= NearbyLimit) .OrderBy(d => d.ObservedAxes.IncludedAngleTo(axisPosition)).Take(numberOfPoints).ToArray(); checkSum = GetChecksum(points.Select(p => p.Id).ToArray()); return(points); }
protected override void SampleAxisMovement(object StateObject) { double reading = _encoder.Angle.Radians; AxisPosition position = Acceptable(reading) ? new AxisPosition() { radians = reading, predicted = false, } : new AxisPosition() { radians = Predicted(reading), predicted = true, }; _currPosition = position; x[0] = x[1]; x[1] = x[2]; x[2] = _currPosition.radians; dx[0] = dx[1]; dx[1] = x[2] - x[1]; ddx = dx[1] - dx[0]; if (Double.IsNaN(_prevPosition.radians)) { Angle currentAngle = Angle.FromRadians(_currPosition.radians); // We don't still have a _prevPosition to check against _prevPosition.radians = _currPosition.radians; _prevHourAngle = currentAngle.Hours; _prevRightAscension = (wisesite.LocalSiderealTime - currentAngle).Hours; return; } _hourAngle = Angle.FromRadians(_currPosition.radians).Hours; _rightAscension = wisesite.LocalSiderealTime.Hours - _hourAngle; _samples.Enqueue(_currPosition); double raDelta = Math.Abs(_rightAscension - _prevRightAscension); double haDelta = Math.Abs(_hourAngle - _prevHourAngle); _raDeltas.Enqueue(raDelta); _haDeltas.Enqueue(haDelta); #region debug debugger.WriteLine(Debugger.DebugLevel.DebugAxes, "{0}:SampleAxisMovement: _currPosition: {1} ({2}), _prevPosition: {3} ({4}), raDelta: {5}, haDelta: {6}, active motors: {7}", WiseName, _currPosition.radians, _currPosition.predicted ? "PREDICTED" : "REAL", _prevPosition.radians, _prevPosition.predicted ? "PREDICTED" : "REAL", raDelta, haDelta, ActiveMotors(_axis)); #endregion _prevPosition.radians = _currPosition.radians; _prevHourAngle = _hourAngle; _prevRightAscension = _rightAscension; }
protected void AddLinearAxis(string axisLabel, AxisPosition position) { var axis = new LinearAxis() { Title = axisLabel, Position = position, MinorTickSize = 0 }; Model.Axes.Add(axis); }
public override Task Rebuild() { this.DebugDepth("Rebuild"); bool valuesChanged = false; var startingAngle = StartingAngle.ClampIfNotCalculated(this, 0, 360 - .01, ref valuesChanged); var endingAngle = EndingAngle.ClampIfNotCalculated(this, startingAngle + .01, 360, ref valuesChanged); var sides = Sides.Value(this); var axisPosition = AxisPosition.Value(this); if (startingAngle > 0 || endingAngle < 360) { Sides = agg_basics.Clamp(sides, 1, 360, ref valuesChanged); } else { Sides = agg_basics.Clamp(sides, 3, 360, ref valuesChanged); } Invalidate(InvalidateType.DisplayValues); var rebuildLock = RebuildLock(); // now create a long running task to process the image return(ApplicationController.Instance.Tasks.Execute( "Revolve".Localize(), null, (reporter, cancellationToken) => { var vertexSource = this.VertexSource; var pathBounds = vertexSource.GetBounds(); vertexSource = vertexSource.Translate(-pathBounds.Left - axisPosition, 0); Mesh mesh = VertexSourceToMesh.Revolve(vertexSource, sides, MathHelper.DegreesToRadians(360 - endingAngle), MathHelper.DegreesToRadians(360 - startingAngle), false); // take the axis offset out mesh.Transform(Matrix4X4.CreateTranslation(pathBounds.Left + axisPosition, 0, 0)); if (mesh.Vertices.Count == 0) { mesh = null; } Mesh = mesh; UiThread.RunOnIdle(() => { rebuildLock.Dispose(); Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children)); }); return Task.CompletedTask; })); }
private LinearAxis CreateNullAxis(string title, AxisPosition axpos) { var newAxis = new LinearAxis { Title = "Null Axis" }; return(newAxis); }
public void Addition(double a1_0, double a1_1, double a2_0, double a2_1, double e_0, double e_1) { AxisPosition pos1 = new AxisPosition(a1_0, a1_1); AxisPosition pos2 = new AxisPosition(a2_0, a2_1); AxisPosition expected = new AxisPosition(e_0, e_1); AxisPosition result = pos1 + pos2; Assert.AreEqual(expected, result); }
private static LinearAxis GetAxis(AxisPosition position) { return(new LinearAxis { Position = position, // означает, будет ли это ось X, или Y AxislineStyle = LineStyle.Solid, // отвечает за тип отрисовки осей (Сплошная линия) PositionAtZeroCrossing = true // означает, сможем ли мы увидеть, как оси пересекаются друг с другом }); }
public static LinearAxis getAxis(String key, String title, AxisPosition axisPosition) { return(new LinearAxis() { Key = key, Position = axisPosition, Title = title, }); }
[DataRow(45.0, 315.0, 315.0, 45.0, -90.0, 90.0)] // both either side of zero public void TestGetSlewAngleTo(double s_0, double s_1, double t_0, double t_1, double e_0, double e_1) { AxisPosition source = new AxisPosition(s_0, s_1); AxisPosition target = new AxisPosition(t_0, t_1); Angle[] expected = new Angle[] { new Angle(e_0), new Angle(e_1) }; Angle[] result = source.GetSlewAnglesTo(target); Assert.IsTrue(expected[0] == result[0] && expected[1] == result[1]); }
public ViewModel() { Series = new ObservableCollection <ISeries> { new ColumnSeries <double> { Values = new ObservableCollection <double> { 2, 5, 4, -2, 4, -3, 5 }, Stroke = null, Fill = new SolidColorPaint { Color = SKColors.DarkOliveGreen } } }; // Places the axis to the right (or top for X axes) _selectedPosition = AxisPosition.End; XAxes = new List <Axis> { new Axis { //Name = "X axis", TextSize = 20, // LabelsPaint = null will not draw the axis labels. LabelsPaint = new SolidColorPaint { Color = SKColors.CornflowerBlue }, // SeparatorsPaint = null will not draw the separator lines SeparatorsPaint = new SolidColorPaint { Color = SKColors.LightBlue, StrokeThickness = 3 }, Position = _selectedPosition } }; YAxes = new List <Axis> { new Axis { //Name = "Y axis", TextSize = 20, LabelsPaint = new SolidColorPaint { Color = SKColors.Red }, SeparatorsPaint = new SolidColorPaint { Color = SKColors.LightPink, StrokeThickness = 3 }, Position = _selectedPosition } }; }
public TimeSpanAxis( AxisPosition position, double minimum, double maximum = double.NaN, string title = null, string format = "m:ss") : base(position, minimum, maximum, title) { this.StringFormat = format; }
public static PlotModel CreateRandomScatterSeriesWithColorAxisPlotModel(int n, OxyPalette palette, MarkerType markerType // = MarkerType.Square , AxisPosition colorAxisPosition) // = AxisPosition.Right //, OxyColor highColor// = null //, OxyColor lowColor)// = null) { return(CreateRandomScatterSeriesWithColorAxisPlotModel(n, palette, markerType, colorAxisPosition, null, null)); }
/// <summary> /// Creates an instance of YSeriesAxis. /// </summary> /// <param name="chart"></param> /// <param name="series"></param> /// <param name="position"></param> public YSeriesAxis(C1Chart chart, DataSeries series, AxisPosition position) : base(chart, series) { AxisType = AxisType.Y; Position = position; if ((position & AxisPosition.Far) > 0) AnnoAngle = 90; else AnnoAngle = -90; MinorTickHeight = 0; }
public DateTimeAxis( AxisPosition position, string title = null, string format = null, DateTimeIntervalType intervalType = DateTimeIntervalType.Auto) : base(position, title) { this.FirstDayOfWeek = DayOfWeek.Monday; this.CalendarWeekRule = CalendarWeekRule.FirstFourDayWeek; this.StringFormat = format; this.IntervalType = intervalType; }
public static PlotModel CreateRandomScatterSeriesWithColorAxisPlotModel(int n, OxyPalette palette, MarkerType markerType = MarkerType.Square, AxisPosition colorAxisPosition = AxisPosition.Right, OxyColor highColor = null, OxyColor lowColor = null) { var model = new PlotModel(string.Format("ScatterSeries (n={0})", n)) { Background = OxyColors.LightGray }; model.Axes.Add(new ColorAxis { Position = colorAxisPosition, Palette = palette, Minimum = -1, Maximum = 1, HighColor = highColor, LowColor = lowColor }); var s1 = new ScatterSeries { MarkerType = markerType, MarkerSize = 6, }; var random = new Random(); for (int i = 0; i < n; i++) { double x = random.NextDouble() * 2.2 - 1.1; s1.Points.Add(new ScatterPoint(x, random.NextDouble()) { Value = x }); } model.Series.Add(s1); return model; }
private void createAxis(long id, AxisPosition pos) { ctCatAx = chart.GetCTChart().plotArea.AddNewCatAx(); ctCatAx.AddNewAxId().val = (uint)id; ctCatAx.AddNewAxPos(); ctCatAx.AddNewScaling(); ctCatAx.AddNewCrosses(); ctCatAx.AddNewCrossAx(); ctCatAx.AddNewTickLblPos().val = ST_TickLblPos.nextTo; ctCatAx.AddNewDelete(); ctCatAx.AddNewMajorTickMark(); ctCatAx.AddNewMinorTickMark(); this.SetPosition(pos); this.SetOrientation(AxisOrientation.MinToMax); this.SetCrosses(AxisCrosses.AutoZero); this.IsVisible = true; this.SetMajorTickMark(AxisTickMark.Cross); this.SetMinorTickMark(AxisTickMark.None); }
public XSSFValueAxis(XSSFChart chart, long id, AxisPosition pos) : base(chart) { CreateAxis(id, pos); }
/// <summary> /// Initializes a new instance of the <see cref="DateTimeAxis" /> class. /// </summary> /// <param name="pos">The position of the axis.</param> /// <param name="firstDateTime">The first date/time on the axis.</param> /// <param name="lastDateTime">The last date/time on the axis.</param> /// <param name="title">The axis title.</param> /// <param name="format">The string format for the axis values.</param> /// <param name="intervalType">The interval type.</param> public DateTimeAxis( AxisPosition pos, DateTime firstDateTime, DateTime lastDateTime, string title = null, string format = null, DateTimeIntervalType intervalType = DateTimeIntervalType.Auto) : this(pos, title, format, intervalType) { this.Minimum = ToDouble(firstDateTime); this.Maximum = ToDouble(lastDateTime); }
public LogarithmicAxis(AxisPosition pos, string title) : this() { this.Position = pos; this.Title = title; }
int MeasureAxisSize(AxisPosition pos) { int max = 0; foreach (Axis ax in axis) if (ax.Position == pos && ax.ShowLabels) { int nmax = MeasureAxisSize (ax); if (nmax > max) max = nmax; } return max; }
public LinearAxis(AxisPosition position, string title) : this() { this.Position = position; this.Title = title; }
double MeasureAxisSize (Context ctx, AxisPosition pos) { double max = 0; foreach (Axis ax in axis) if (ax.Position == pos && ax.ShowLabels) { double nmax = MeasureAxisSize (ctx, ax); if (nmax > max) max = nmax; } return max; }
/// <summary> /// Constructor, which defines the world pixel length together with /// the y-axis that should be held constant when forcing this /// constraint [the other y-axis only will be moved]. /// </summary> /// <param name="p">The world pixel length</param> /// <param name="holdFixedY">The position of this y-axis will be /// held constant. The other y-axis will be moved in order to /// force the constraint.</param> public XPixelWorldLength(double p, AxisPosition holdFixedY) { pWorldLength_ = p; holdFixedY_ = holdFixedY; }
public IValueAxis CreateValueAxis(AxisPosition pos) { long id = axis.Count + 1; XSSFValueAxis valueAxis = new XSSFValueAxis(this, id, pos); if (axis.Count == 1) { IChartAxis ax = axis[0]; ax.CrossAxis(valueAxis); valueAxis.CrossAxis(ax); } axis.Add(valueAxis); return valueAxis; }
/// <summary> /// The get tick positions. /// </summary> /// <param name="axis"> /// The axis. /// </param> /// <param name="glt"> /// The glt. /// </param> /// <param name="ticksize"> /// The ticksize. /// </param> /// <param name="position"> /// The position. /// </param> /// <param name="x0"> /// The x 0. /// </param> /// <param name="x1"> /// The x 1. /// </param> protected void GetTickPositions( Axis axis, TickStyle glt, double ticksize, AxisPosition position, out double x0, out double x1) { x0 = 0; x1 = 0; bool isTopOrLeft = position == AxisPosition.Top || position == AxisPosition.Left; double sign = isTopOrLeft ? -1 : 1; switch (glt) { case TickStyle.Crossing: x0 = -ticksize * sign * 0.75; x1 = ticksize * sign * 0.75; break; case TickStyle.Inside: x0 = -ticksize * sign; break; case TickStyle.Outside: x1 = ticksize * sign; break; } }
/// <summary> /// Initializes a new instance of the <see cref="TimeSpanAxis"/> class. /// </summary> /// <param name="pos"> /// The position. /// </param> /// <param name="min"> /// The min. /// </param> /// <param name="max"> /// The max. /// </param> /// <param name="title"> /// The axis title. /// </param> /// <param name="format"> /// The string format for the axis values. /// </param> public TimeSpanAxis( AxisPosition pos = AxisPosition.Bottom, double min = double.NaN, double max = double.NaN, string title = null, string format = "m:ss") : base(pos, min, max, title) { this.StringFormat = format; }
/// <summary> /// Initializes a new instance of the <see cref="TimeSpanAxis"/> class. /// </summary> /// <param name="pos"> /// The position. /// </param> /// <param name="title"> /// The axis title. /// </param> /// <param name="format"> /// The string format for the axis values. /// </param> public TimeSpanAxis(AxisPosition pos, string title = null, string format = "m:ss") : base(pos, title) { this.StringFormat = format; }
public XSSFCategoryAxis(XSSFChart chart, long id, AxisPosition pos) : base(chart) { createAxis(id, pos); }
/// <summary> /// Initializes a new instance of the <see cref="Axis"/> class. /// </summary> /// <param name="pos"> /// The position of the axis. /// </param> /// <param name="minimum"> /// The minimum value. /// </param> /// <param name="maximum"> /// The maximum value. /// </param> /// <param name="title"> /// The axis title. /// </param> protected Axis(AxisPosition pos, double minimum, double maximum, string title = null) : this() { this.Position = pos; this.Minimum = minimum; this.Maximum = maximum; this.AbsoluteMaximum = double.NaN; this.AbsoluteMinimum = double.NaN; this.Title = title; }
private void CreateAxis(long id, AxisPosition pos) { ctValAx = chart.GetCTChart().plotArea.AddNewValAx(); ctValAx.AddNewAxId().val = (uint)id; ctValAx.AddNewAxPos(); ctValAx.AddNewScaling(); ctValAx.AddNewCrossBetween(); ctValAx.AddNewCrosses(); ctValAx.AddNewCrossAx(); ctValAx.AddNewTickLblPos().val = ST_TickLblPos.nextTo; SetPosition(pos); SetOrientation(AxisOrientation.MIN_MAX); SetCrossBetween(AxisCrossBetween.MIDPOINT_CATEGORY); SetCrosses(AxisCrosses.AUTO_ZERO); }
/// <summary> /// Constructor, which defines the world pixel length together with /// the x-axis that should be held constant when forcing this /// constraint [the other x-axis only will be moved]. /// </summary> /// <param name="p">The world pixel length</param> /// <param name="holdFixedX">The position of this x-axis will be held constant. The other x-axis will be moved in order to force the constraint.</param> public YPixelWorldLength(double p, AxisPosition holdFixedX) { pWorldLength_ = p; holdFixedX_ = holdFixedX; }
public IChartAxis CreateCategoryAxis(AxisPosition pos) { long id = axis.Count + 1; XSSFCategoryAxis categoryAxis = new XSSFCategoryAxis(this, id, pos); if (axis.Count == 1) { IChartAxis ax = axis[0]; ax.CrossAxis(categoryAxis); categoryAxis.CrossAxis(ax); } axis.Add(categoryAxis); return categoryAxis; }
public void AddAxis(Axis ax, AxisPosition position) { ax.Owner = this; ax.Position = position; axis.Add (ax); QueueDraw (); }
void DrawTicks(Gdk.Window win, Gdk.GC gc, TickEnumerator e, AxisPosition pos, AxisDimension ad, int tickSize, bool showLabels) { int rwidth, rheight; win.GetSize (out rwidth, out rheight); Pango.Layout layout = null; if (showLabels) { layout = new Pango.Layout (this.PangoContext); layout.FontDescription = Pango.FontDescription.FromString ("Tahoma 8"); } bool isX = pos == AxisPosition.Top || pos == AxisPosition.Bottom; bool isTop = pos == AxisPosition.Top || pos == AxisPosition.Right; double start = GetStart (ad); double end = GetEnd (ad); e.Init (GetOrigin (ad)); while (e.CurrentValue > start) e.MovePrevious (); int lastPosLabel; int lastPos; int lastTw = 0; if (isX) { lastPosLabel = reverseXAxis ? left + width + MinLabelGapX : left - MinLabelGapX; lastPos = left - minTickStep*2; } else { lastPosLabel = reverseYAxis ? top - MinLabelGapY : rheight + MinLabelGapY; lastPos = top + height + minTickStep*2; } for ( ; e.CurrentValue <= end; e.MoveNext ()) { int px, py; int tw = 0, th = 0; int tick = tickSize; GetPoint (e.CurrentValue, e.CurrentValue, out px, out py); if (showLabels) { layout.SetMarkup (e.CurrentLabel); layout.GetPixelSize (out tw, out th); } if (isX) { if (Math.Abs ((long)px - (long)lastPos) < minTickStep || px < left || px > left + width) continue; lastPos = px; bool labelFits = false; if ((Math.Abs (px - lastPosLabel) - (tw/2) - (lastTw/2)) >= MinLabelGapX) { lastPosLabel = px; lastTw = tw; labelFits = true; } if (isTop) { if (showLabels) { if (labelFits) win.DrawLayout (gc, px - (tw/2), top - AreaBorderWidth - th, layout); else tick = tick / 2; } win.DrawLine (gc, px, top, px, top + tick); } else { if (showLabels) { if (labelFits) win.DrawLayout (gc, px - (tw/2), top + height + AreaBorderWidth, layout); else tick = tick / 2; } win.DrawLine (gc, px, top + height, px, top + height - tick); } } else { if (Math.Abs ((long)lastPos - (long)py) < minTickStep || py < top || py > top + height) continue; lastPos = py; bool labelFits = false; if ((Math.Abs (py - lastPosLabel) - (th/2) - (lastTw/2)) >= MinLabelGapY) { lastPosLabel = py; lastTw = th; labelFits = true; } if (isTop) { if (showLabels) { if (labelFits) win.DrawLayout (gc, left + width + AreaBorderWidth + 1, py - (th/2), layout); else tick = tick / 2; } win.DrawLine (gc, left + width, py, left + width - tick, py); } else { if (showLabels) { if (labelFits) win.DrawLayout (gc, left - AreaBorderWidth - tw - 1, py - (th/2), layout); else tick = tick / 2; } win.DrawLine (gc, left, py, left + tick, py); } } } }
/// <summary> /// Initializes a new instance of the <see cref="CategoryAxis"/> class. /// </summary> /// <param name="position">The position.</param> /// <param name="title">The title.</param> /// <param name="categories">The categories.</param> public CategoryAxis(AxisPosition position, string title = null, params string[] categories) : this(title, categories) { this.Position = position; }
public LinearAxis(AxisPosition position, double minimum = double.NaN, double maximum = double.NaN, string title = null) : this(position, minimum, maximum, double.NaN, double.NaN, title) { }