Skip to content

Commit 8094ca4

Browse files
authored
Merge pull request oxyplot#1313 from VisualMelon/AnnotationLineStyleNoneExample
Add example of Annotations rendering incorrectly with LineStyle.None
2 parents 222c3db + c98c6da commit 8094ca4

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file.
1919
- ContinuousHistogramSeries (#1145)
2020
- Multiline text support for PortableDocumentFont (#1146)
2121
- Workaround for text vertical alignment in SVG Export to accomodate viewers which don't support dominant-baseline (#459, #1198)
22+
- Issues Example demonstrating the rendering of Line and Arrow annotations with all LineStyles (#1312)
2223

2324
### Changed
2425
- Let Gtk# PlotView show up in Ui editor ToolBox of MonoDevelop and XamarinStudio (#1071)

Source/Examples/ExampleLibrary/Issues/Issues.cs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,6 +1942,57 @@ public static PlotModel ExportTransparentTextAnnotationToSvg()
19421942
return plot;
19431943
}
19441944

1945+
[Example("#1312: Annotations ignore LineStyle.None and draw as if Solid")]
1946+
public static PlotModel DrawArrowAnnotationsWithDifferentLineStyles()
1947+
{
1948+
LineStyle[] lineStyles = new []
1949+
{
1950+
LineStyle.Solid,
1951+
LineStyle.Dash,
1952+
LineStyle.Dot,
1953+
LineStyle.DashDot,
1954+
LineStyle.DashDashDot,
1955+
LineStyle.DashDotDot,
1956+
LineStyle.DashDashDotDot,
1957+
LineStyle.LongDash,
1958+
LineStyle.LongDashDotDot,
1959+
LineStyle.None,
1960+
LineStyle.Automatic
1961+
};
1962+
1963+
var plot = new PlotModel() { Title = "Annotation Line Styles", Subtitle = "'None' should produce nothing" };
1964+
plot.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Minimum = 0, Maximum = lineStyles.Length * 10 + 10 });
1965+
plot.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, Minimum = 0, Maximum = 100 });
1966+
1967+
double y = 10;
1968+
foreach (var lineStyle in lineStyles)
1969+
{
1970+
plot.Annotations.Add(new LineAnnotation()
1971+
{
1972+
LineStyle = lineStyle,
1973+
Type = LineAnnotationType.Horizontal,
1974+
Y = y,
1975+
MinimumX = 10,
1976+
MaximumX = 45
1977+
});
1978+
1979+
plot.Annotations.Add(new ArrowAnnotation()
1980+
{
1981+
LineStyle = lineStyle,
1982+
Text = lineStyle.ToString(),
1983+
TextHorizontalAlignment = HorizontalAlignment.Center,
1984+
TextVerticalAlignment = VerticalAlignment.Bottom,
1985+
TextPosition = new DataPoint(50, y),
1986+
StartPoint = new DataPoint(55, y),
1987+
EndPoint = new DataPoint(90, y)
1988+
});
1989+
1990+
y += 10;
1991+
}
1992+
1993+
return plot;
1994+
}
1995+
19451996
private class TimeSpanPoint
19461997
{
19471998
public TimeSpan X { get; set; }

0 commit comments

Comments
 (0)