See More

using System; using System.Collections.Generic; using System.Linq; using MatplotlibCS.PlotItems; using Newtonsoft.Json; namespace MatplotlibCS { ///

[JsonObject(Title = "axes")] public class Axes : IHealthCheck { #region .ctor /// /// Конструктор /// /// /// Заголовок оси x /// Заголовок оси y public Axes(int index = 1, string xtitle = "", string ytitle = "") { this.Index = index; this.XTitle = xtitle; this.YTitle = ytitle; Grid = new Grid(); PlotItems = new List(); } #endregion #region Properties /// /// Заголовок осей /// [JsonProperty(PropertyName = "title", DefaultValueHandling = DefaultValueHandling.Include)] public string Title { get; set; } /// /// Подпись к оси X /// [JsonProperty(PropertyName = "xtitle")] public string XTitle { get; set; } /// /// Подпись к оси Y /// [JsonProperty(PropertyName = "ytitle")] public string YTitle { get; set; } /// /// Индекс subplot-а на figure /// [JsonProperty(PropertyName = "index")] public int Index { get; set; } = 1; /// /// Plot grid settings /// [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; /// /// 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 /// [JsonProperty(PropertyName = "__items__")] public List PlotItems { get; set; } #endregion #region Indexers /// /// Returnts first plot item by its name /// /// Name of an item /// public PlotItem this[string name] { get { return PlotItems.FirstOrDefault(_ => _.Name == name); } } #endregion public void HealthCheck() { Grid.HealthCheck(); foreach (var plotItem in PlotItems) { plotItem.HealthCheck(); } } } /// /// Defines where a legend will be located on a chart /// public enum LegendLocation { Best, UpperRight, UpperLeft, LowerLeft, LowerRight, Right, CenterLeft, CenterRight, LowerCenter, UpperCenter, Center } }