Repository navigation
Expand file tree
/
Copy pathAnnotation.cs
More file actions
72 lines (58 loc) · 1.96 KB
/
Copy pathAnnotation.cs
File metadata and controls
72 lines (58 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace MatplotlibCS.PlotItems
{
/// <summary>
/// Text with an arrow on a plot
/// </summary>
public class Annotation : PlotItem
{
public Annotation(string name, string text, double textX, double textY, double arrowX, double arrowY) : base(name)
{
this.Text = text;
TextLeftCornerX = textX;
TextLeftCornerY = textY;
ArrowX = arrowX;
ArrowY = arrowY;
}
[JsonProperty(PropertyName = "text")]
public string Text { get; set; }
[JsonProperty(PropertyName = "text_x")]
public double TextLeftCornerX { get; set; }
[JsonProperty(PropertyName = "text_y")]
public double TextLeftCornerY { get; set; }
[JsonProperty(PropertyName = "arrow_x")]
public double ArrowX { get; set; }
[JsonProperty(PropertyName = "arrow_y")]
public double ArrowY { get; set; }
[JsonProperty(PropertyName = "fontSize")]
public double FontSize { get; set; } = 12;
[JsonProperty(PropertyName = "color")]
public Color Color { get; set; } = Color.Black;
/// <summary>
/// Color transparency
/// </summary>
[JsonProperty(PropertyName = "alpha")]
public double Alpha { get; set; } = 1;
[JsonProperty(PropertyName = "arrow_style")]
[JsonConverter(typeof(StringEnumConverter))]
public ArrowStyle ArrowStyle { get; set; } = ArrowStyle.End;
[JsonProperty(PropertyName = "lineWidth")]
public float LineWidth { get; set; } = 1;
}
public enum ArrowStyle
{
[EnumMember(Value = "<-")]
Begin,
[EnumMember(Value = "->")]
End,
[EnumMember(Value = "<->")]
Both
}
}