Repository navigation
Expand file tree
/
Copy pathAxes.cs
More file actions
124 lines (104 loc) · 3.33 KB
/
Copy pathAxes.cs
File metadata and controls
124 lines (104 loc) · 3.33 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
using System;
using System.Collections.Generic;
using System.Linq;
using MatplotlibCS.PlotItems;
using Newtonsoft.Json;
namespace MatplotlibCS
{
/// <summary></summary>
[JsonObject(Title = "axes")]
public class Axes : IHealthCheck
{
#region .ctor
/// <summary>
/// Конструктор
/// </summary>
/// <param name="index"></param>
/// <param name="xtitle">Заголовок оси x</param>
/// <param name="ytitle">Заголовок оси y</param>
public Axes(int index = 1, string xtitle = "", string ytitle = "")
{
this.Index = index;
this.XTitle = xtitle;
this.YTitle = ytitle;
Grid = new Grid();
PlotItems = new List<PlotItem>();
}
#endregion
#region Properties
/// <summary>
/// Заголовок осей
/// </summary>
[JsonProperty(PropertyName = "title", DefaultValueHandling = DefaultValueHandling.Include)]
public string Title { get; set; }
/// <summary>
/// Подпись к оси X
/// </summary>
[JsonProperty(PropertyName = "xtitle")]
public string XTitle { get; set; }
/// <summary>
/// Подпись к оси Y
/// </summary>
[JsonProperty(PropertyName = "ytitle")]
public string YTitle { get; set; }
/// <summary>
/// Индекс subplot-а на figure
/// </summary>
[JsonProperty(PropertyName = "index")]
public int Index { get; set; } = 1;
/// <summary>
/// Plot grid settings
/// </summary>
[JsonProperty(PropertyName = "grid")]
public Grid Grid { get; set; }
[JsonProperty(PropertyName = "show_legend")]
public bool ShowLegend { get; set; } = true;
[JsonProperty(PropertyName = "legend_location")]
public LegendLocation LegendLocation { get; set; } = LegendLocation.Best;
[JsonProperty(PropertyName = "frameon")]
public bool LegendBorder { get; set; } = true;
/// <summary>
/// Lines and other plot items. Never add items to this list directly, only set the list itself. For adding/removing
/// items use AddItem/RemoveItem methods
/// </summary>
[JsonProperty(PropertyName = "__items__")]
public List<PlotItem> PlotItems { get; set; }
#endregion
#region Indexers
/// <summary>
/// Returnts first plot item by its name
/// </summary>
/// <param name="name">Name of an item</param>
/// <returns></returns>
public PlotItem this[string name]
{
get { return PlotItems.FirstOrDefault(_ => _.Name == name); }
}
#endregion
public void HealthCheck()
{
Grid.HealthCheck();
foreach (var plotItem in PlotItems)
{
plotItem.HealthCheck();
}
}
}
/// <summary>
/// Defines where a legend will be located on a chart
/// </summary>
public enum LegendLocation
{
Best,
UpperRight,
UpperLeft,
LowerLeft,
LowerRight,
Right,
CenterLeft,
CenterRight,
LowerCenter,
UpperCenter,
Center
}
}