Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use state component visualizer label in Y axis #21

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions src/Bonsai.ML.Visualizers/StateComponentVisualizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public override void Load(IServiceProvider provider)
var areaSeriesName = string.IsNullOrEmpty(Label) ? "Variance" : $"{Label} Variance";
AreaSeries = Plot.AddNewAreaSeries(areaSeriesName, color: AreaSeriesColor);

if (Label != null) Plot.ValueLabel = Label;
Plot.ResetLineSeries(LineSeries);
Plot.ResetAreaSeries(AreaSeries);
Plot.ResetAxes();
Expand Down
26 changes: 15 additions & 11 deletions src/Bonsai.ML.Visualizers/TimeSeriesOxyPlotBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ namespace Bonsai.ML.Visualizers
{
internal class TimeSeriesOxyPlotBase : UserControl
{
private PlotView view;
private PlotModel model;
private OxyColor defaultLineSeriesColor = OxyColors.Blue;
private OxyColor defaultAreaSeriesColor = OxyColors.LightBlue;
private readonly PlotView view;
private readonly PlotModel model;
private static readonly OxyColor defaultLineSeriesColor = OxyColors.Blue;
private static readonly OxyColor defaultAreaSeriesColor = OxyColors.LightBlue;

private Axis xAxis;
private Axis yAxis;
private readonly Axis xAxis;
private readonly Axis yAxis;

private StatusStrip statusStrip;
private readonly StatusStrip statusStrip;

/// <summary>
/// Gets or sets the datetime value that determines the starting time of the data values.
Expand All @@ -42,14 +42,18 @@ internal class TimeSeriesOxyPlotBase : UserControl
public bool BufferData { get; set; }

/// <summary>
/// Initializes a new instance of the <see cref="TimeSeriesOxyPlotBase"/> class
/// Gets or sets the label of the value axis in the time series plot.
/// </summary>
public TimeSeriesOxyPlotBase()
public string ValueLabel
{
Initialize();
get => yAxis.Title;
set => yAxis.Title = value;
}

private void Initialize()
/// <summary>
/// Initializes a new instance of the <see cref="TimeSeriesOxyPlotBase"/> class
/// </summary>
public TimeSeriesOxyPlotBase()
{
view = new PlotView
{
Expand Down
Loading