Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public override void Render(IRenderContext rc)
rc.DrawLineSegments(verticalLines, this.ActualColor, this.StrokeThickness / 3, this.EdgeRenderingMode, LineStyle.Dash.GetDashArray(), this.LineJoin);
}

rc.DrawMarkers(screenPoints, this.MarkerType, null, this.MarkerSize, this.MarkerFill, this.MarkerStroke, this.MarkerStrokeThickness, this.EdgeRenderingMode);
rc.DrawMarkers(screenPoints, this.MarkerType, null, this.MarkerSize, this.MarkerFill, this.MarkerStroke, this.MarkerStrokeThickness, this.EdgeRenderingMode, null);
}

/// <summary>
Expand Down
11 changes: 10 additions & 1 deletion Source/Examples/ExampleLibrary/Series/LineSeriesExamples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,17 @@ public static PlotModel MarkerTypes()
ls.Color = OxyColors.Red;
ls.MarkerStroke = OxyColors.Black;
ls.MarkerFill = OxyColors.Green;
ls.MarkerType = (MarkerType)i++;
ls.MarkerStrokeThickness = 2;
ls.MarkerSize = 7;
ls.MarkerType = (MarkerType)i;
ls.MarkerLineStyle = (LineStyle)i;
if (i == 8)
{
ls.MarkerType = MarkerType.Triangle;
}
ls.Title = ls.MarkerType.ToString();

i++;
}

return pm;
Expand Down
8 changes: 4 additions & 4 deletions Source/Examples/PerformanceTest/EmptyRenderContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ public void CleanUp()
}

/// <inheritdoc/>
public void DrawEllipse(OxyRect extents, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public void DrawEllipse(OxyRect extents, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray = null)
{
}

/// <inheritdoc/>
public void DrawEllipses(IList<OxyRect> extents, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public void DrawEllipses(IList<OxyRect> extents, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray = null)
{
}

Expand Down Expand Up @@ -75,12 +75,12 @@ public void DrawPolygons(IList<IList<ScreenPoint>> polygons, OxyColor fill, OxyC
}

/// <inheritdoc/>
public void DrawRectangle(OxyRect rectangle, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public void DrawRectangle(OxyRect rectangle, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray)
{
}

/// <inheritdoc/>
public void DrawRectangles(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public void DrawRectangles(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray)
{
}

Expand Down
4 changes: 2 additions & 2 deletions Source/OxyPlot.Pdf/PdfRenderContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void Dispose()
}

/// <inheritdoc/>
public override void DrawEllipse(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public override void DrawEllipse(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray = null)
{
this.SetSmoothingMode(this.ShouldUseAntiAliasingForEllipse(edgeRenderingMode));

Expand Down Expand Up @@ -179,7 +179,7 @@ public override void DrawPolygon(
}

/// <inheritdoc/>
public override void DrawRectangle(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public override void DrawRectangle(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray = null)
{
this.SetSmoothingMode(this.ShouldUseAntiAliasingForRect(edgeRenderingMode));
if (fill.IsVisible())
Expand Down
8 changes: 4 additions & 4 deletions Source/OxyPlot.SkiaSharp/SkiaRenderContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void Dispose()
}

/// <inheritdoc/>
public void DrawEllipse(OxyRect extents, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public void DrawEllipse(OxyRect extents, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray = null)
{
if (!fill.IsVisible() && !(stroke.IsVisible() || thickness <= 0))
{
Expand All @@ -110,7 +110,7 @@ public void DrawEllipse(OxyRect extents, OxyColor fill, OxyColor stroke, double
}

/// <inheritdoc/>
public void DrawEllipses(IList<OxyRect> extents, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public void DrawEllipses(IList<OxyRect> extents, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray = null)
{
if (!fill.IsVisible() && (!stroke.IsVisible() || thickness <= 0))
{
Expand Down Expand Up @@ -315,7 +315,7 @@ public void DrawPolygons(
}

/// <inheritdoc/>
public void DrawRectangle(OxyRect rectangle, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public void DrawRectangle(OxyRect rectangle, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray = null)
{
if (!fill.IsVisible() && !(stroke.IsVisible() || thickness <= 0))
{
Expand All @@ -338,7 +338,7 @@ public void DrawRectangle(OxyRect rectangle, OxyColor fill, OxyColor stroke, dou
}

/// <inheritdoc/>
public void DrawRectangles(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public void DrawRectangles(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray = null)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused parameter (issue throughout file)

@KeithBrio KeithBrio Nov 15, 2023 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VisualMelon What would your expectation to solve this be here to solve this?

Add a new specific method on IRenderContext and use it appropriately in calling classes?

As I noted initially, I hacked into these changes for my personal project years ago, and not familiar with the architecture or the design philosophy, so any direction is greatly appreciated.

{
if (!fill.IsVisible() && !(stroke.IsVisible() || thickness <= 0) || rectangles.Count == 0)
{
Expand Down
1 change: 1 addition & 0 deletions Source/OxyPlot.Wpf.Shared/OxyPlot.Wpf.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<PackageTags>plotting plot charting chart wpf</PackageTags>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>OxyPlot.Wpf.Shared.snk</AssemblyOriginatorKeyFile>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
Comment thread
KeithBrio marked this conversation as resolved.
Outdated
</PropertyGroup>
<ItemGroup>
<None Include="OxyPlot.Wpf.Shared.snk" />
Expand Down
16 changes: 8 additions & 8 deletions Source/OxyPlot.Wpf/CanvasRenderContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,21 @@ public CanvasRenderContext(Canvas canvas)
public TextFormattingMode TextFormattingMode { get; set; }

///<inheritdoc/>
public override void DrawEllipse(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public override void DrawEllipse(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray = null)
{
this.DrawEllipses(new[] { rect }, fill, stroke, thickness, edgeRenderingMode);
this.DrawEllipses(new[] { rect }, fill, stroke, thickness, edgeRenderingMode, dashArray);
}

///<inheritdoc/>
public override void DrawEllipses(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public override void DrawEllipses(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray = null)
{
if (rectangles.Count == 0)
{
return;
}

var path = this.CreateAndAdd<Path>();
this.SetStroke(path, stroke, thickness, edgeRenderingMode);
this.SetStroke(path, stroke, thickness, edgeRenderingMode, LineJoin.Miter, dashArray);
if (!fill.IsUndefined())
{
path.Fill = this.GetCachedBrush(fill);
Expand Down Expand Up @@ -263,21 +263,21 @@ public override void DrawPolygons(
}

///<inheritdoc/>
public override void DrawRectangle(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public override void DrawRectangle(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray = null)
{
this.DrawRectangles(new[] { rect }, fill, stroke, thickness, edgeRenderingMode);
this.DrawRectangles(new[] { rect }, fill, stroke, thickness, edgeRenderingMode, dashArray);
}

///<inheritdoc/>
public override void DrawRectangles(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public override void DrawRectangles(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray = null)
{
if (rectangles.Count == 0)
{
return;
}

var path = this.CreateAndAdd<Path>();
this.SetStroke(path, stroke, thickness, edgeRenderingMode);
this.SetStroke(path, stroke, thickness, edgeRenderingMode, LineJoin.Miter, dashArray);
if (!fill.IsUndefined())
{
path.Fill = this.GetCachedBrush(fill);
Expand Down
3 changes: 3 additions & 0 deletions Source/OxyPlot.Wpf/OxyPlot.Wpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<SignAssembly>True</SignAssembly>
<Description>OxyPlot is a plotting library for .NET. This package targets WPF applications.</Description>
<PackageTags>plotting plot charting chart</PackageTags>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/oxyplot/oxyplot.git</RepositoryUrl>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<None Include="OxyPlot.Wpf.snk" />
Expand Down
4 changes: 2 additions & 2 deletions Source/OxyPlot.Wpf/XamlRenderContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public XamlRenderContext(Canvas canvas) : base(canvas)
public double BalancedLineDrawingThicknessLimit { get; set; }

///<inheritdoc/>
public override void DrawEllipses(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public override void DrawEllipses(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray = null)
{
if (rectangles.Count == 0)
{
Expand Down Expand Up @@ -224,7 +224,7 @@ public override void DrawPolygons(
}

///<inheritdoc/>
public override void DrawRectangles(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public override void DrawRectangles(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray = null)
{
if (rectangles.Count == 0)
{
Expand Down
13 changes: 12 additions & 1 deletion Source/OxyPlot/Annotations/PointAnnotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ public PointAnnotation()
/// <value>The shape.</value>
public MarkerType Shape { get; set; }

/// <summary>
/// Gets or sets the marker line style. The default is <see cref="OxyPlot.LineStyle.Automatic" />.
/// </summary>
/// <value>The line style.</value>
public LineStyle MarkerLineStyle { get; set; }

/// <summary>
/// Gets the actual dash array for the marker.
/// </summary>
protected double[]? ActualMarkerDashArray => this.MarkerLineStyle.GetDashArray();

/// <summary>
/// Gets or sets a custom polygon outline for the point marker. Set <see cref="Shape" /> to <see cref="MarkerType.Custom" /> to use this property.
/// </summary>
Expand All @@ -71,7 +82,7 @@ public override void Render(IRenderContext rc)

this.screenPosition = this.Transform(this.X, this.Y);

rc.DrawMarker(this.screenPosition, this.Shape, this.CustomOutline, this.Size, this.Fill, this.Stroke, this.StrokeThickness, this.EdgeRenderingMode);
rc.DrawMarker(this.screenPosition, this.Shape, this.CustomOutline, this.Size, this.Fill, this.Stroke, this.StrokeThickness, this.EdgeRenderingMode, this.ActualMarkerDashArray);

if (this.Text != null &&
!string.IsNullOrEmpty(this.Text))
Expand Down
2 changes: 2 additions & 0 deletions Source/OxyPlot/OxyPlot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<LangVersion>8</LangVersion>
<NoWarn>$(NoWarn);CS0618</NoWarn>
<NoWarn>618</NoWarn>
Comment thread
KeithBrio marked this conversation as resolved.
Outdated
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<None Include="OxyPlot.snk" />
Expand Down
6 changes: 4 additions & 2 deletions Source/OxyPlot/Pdf/PdfRenderContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public void Save(Stream s)
/// <param name="stroke">The stroke color.</param>
/// <param name="thickness">The thickness.</param>
/// <param name="edgeRenderingMode">The edge rendering mode. This is not supported and will be ignored.</param>
public override void DrawEllipse(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
/// <param name="dashArray">The dash array.</param>
public override void DrawEllipse(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray)
{
var isStroked = stroke.IsVisible() && thickness > 0;
var isFilled = fill.IsVisible();
Expand Down Expand Up @@ -208,7 +209,8 @@ public override void DrawPolygon(
/// <param name="stroke">The stroke color.</param>
/// <param name="thickness">The stroke thickness.</param>
/// <param name="edgeRenderingMode">The edge rendering mode. This is not supported and will be ignored.</param>
public override void DrawRectangle(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
/// <param name="dashArray">The dash array.</param>
public override void DrawRectangle(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray = null)
{
var isStroked = stroke.IsVisible() && thickness > 0;
var isFilled = fill.IsVisible();
Expand Down
12 changes: 8 additions & 4 deletions Source/OxyPlot/Rendering/RenderContext/IRenderContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public interface IRenderContext
/// <param name="stroke">The stroke color. If set to <c>OxyColors.Undefined</c>, the extents will not be stroked.</param>
/// <param name="thickness">The thickness (in device independent units, 1/96 inch).</param>
/// <param name="edgeRenderingMode">The edge rendering mode.</param>
void DrawEllipse(OxyRect extents, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode);
/// <param name="dashArray"></param>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✏ missing comment.

void DrawEllipse(OxyRect extents, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[]? dashArray = null);

/// <summary>
/// Draws a collection of ellipses, where all have the same stroke and fill.
Expand All @@ -42,10 +43,11 @@ public interface IRenderContext
/// <param name="stroke">The stroke color. If set to <c>OxyColors.Undefined</c>, the ellipses will not be stroked.</param>
/// <param name="thickness">The stroke thickness (in device independent units, 1/96 inch).</param>
/// <param name="edgeRenderingMode">The edge rendering mode.</param>
/// <param name="dashArray"></param>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✏ missing comment.

/// <remarks>
/// This should have better performance than calling <see cref="DrawEllipse" /> multiple times.
/// </remarks>
void DrawEllipses(IList<OxyRect> extents, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode);
void DrawEllipses(IList<OxyRect> extents, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[]? dashArray = null);

/// <summary>
/// Draws a polyline.
Expand Down Expand Up @@ -133,7 +135,8 @@ void DrawPolygons(
/// <param name="stroke">The stroke color. If set to <c>OxyColors.Undefined</c>, the rectangle will not be stroked.</param>
/// <param name="thickness">The stroke thickness (in device independent units, 1/96 inch).</param>
/// <param name="edgeRenderingMode">The edge rendering mode.</param>
void DrawRectangle(OxyRect rectangle, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode);
/// <param name="dashArray"></param>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✏ missing comment.

void DrawRectangle(OxyRect rectangle, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[]? dashArray = null);

/// <summary>
/// Draws a collection of extents, where all have the same stroke and fill.
Expand All @@ -143,10 +146,11 @@ void DrawPolygons(
/// <param name="stroke">The stroke color. If set to <c>OxyColors.Undefined</c>, the extents will not be stroked.</param>
/// <param name="thickness">The stroke thickness (in device independent units, 1/96 inch).</param>
/// <param name="edgeRenderingMode">The edge rendering mode.</param>
/// <param name="dashArray"></param>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✏ missing comment.

/// <remarks>
/// This should have better performance than calling <see cref="DrawRectangle" /> multiple times.
/// </remarks>
void DrawRectangles(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode);
void DrawRectangles(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[]? dashArray = null);

/// <summary>
/// Draws text.
Expand Down
14 changes: 7 additions & 7 deletions Source/OxyPlot/Rendering/RenderContext/RenderContextBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,18 @@ public static bool IsStraightLine(IList<ScreenPoint> points)
public bool RendersToScreen { get; set; }

/// <inheritdoc/>
public virtual void DrawEllipse(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public virtual void DrawEllipse(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray)
{
var polygon = CreateEllipse(rect);
this.DrawPolygon(polygon, fill, stroke, thickness, edgeRenderingMode, null, LineJoin.Miter);
}

/// <inheritdoc/>
public virtual void DrawEllipses(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public virtual void DrawEllipses(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray)
{
foreach (var r in rectangles)
{
this.DrawEllipse(r, fill, stroke, thickness, edgeRenderingMode);
this.DrawEllipse(r, fill, stroke, thickness, edgeRenderingMode, dashArray);
}
}

Expand Down Expand Up @@ -133,18 +133,18 @@ public virtual void DrawPolygons(
}

/// <inheritdoc/>
public virtual void DrawRectangle(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public virtual void DrawRectangle(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray = null)
{
var polygon = CreateRectangle(rect);
this.DrawPolygon(polygon, fill, stroke, thickness, edgeRenderingMode, null, LineJoin.Miter);
this.DrawPolygon(polygon, fill, stroke, thickness, edgeRenderingMode, dashArray, LineJoin.Miter);
}

/// <inheritdoc/>
public virtual void DrawRectangles(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode)
public virtual void DrawRectangles(IList<OxyRect> rectangles, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode edgeRenderingMode, double[] dashArray = null)
{
foreach (var r in rectangles)
{
this.DrawRectangle(r, fill, stroke, thickness, edgeRenderingMode);
this.DrawRectangle(r, fill, stroke, thickness, edgeRenderingMode, dashArray);
}
}

Expand Down
Loading