Skip to content

Commit

Permalink
Add AxisDisplayMode field to scatter visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
vulh-infragistics committed Jan 20, 2025
1 parent 5d29efb commit 680d0ff
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public RdashDocument CreateDashboard()
settings.YAxisIsLogarithmic = true;
settings.YAxisMaxValue = 750000;
settings.YAxisMinValue = 100;
settings.AxisDisplayMode = AxisDisplayMode.None;
});

// Data Specs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using System;

namespace Reveal.Sdk.Dom.Visualizations.Settings
{
Expand Down Expand Up @@ -26,5 +27,59 @@ public ScatterVisualizationSettings()
/// </summary>
[JsonProperty("RightAxisMaxValue")]
public double? XAxisMaxValue { get; set; }

/// <summary>
/// Gets or sets if the visualization will display the X axis.
/// This property is being wrapped by the <see cref="AxisDisplayMode"/> to simplify the API.
/// </summary>
[JsonProperty]
internal bool ShowAxisX { get; set; } = true;

/// <summary>
/// Gets or sets if the visualization will display the Y axis.
/// This property is being wrapped by the <see cref="AxisDisplayMode"/> to simplify the API.
/// </summary>
[JsonProperty]
internal bool ShowAxisY { get; set; } = true;

/// <summary>
/// Gets or sets the display mode for the axis.
/// </summary>
[JsonIgnore]
public AxisDisplayMode AxisDisplayMode
{
get
{
if (ShowAxisX && ShowAxisY) return AxisDisplayMode.Both;
if (!ShowAxisX && !ShowAxisY) return AxisDisplayMode.None;
if (ShowAxisX) return AxisDisplayMode.XAxis;
if (ShowAxisY) return AxisDisplayMode.YAxis;
throw new InvalidOperationException("Invalid axis visibility state.");
}
set
{
switch (value)
{
case AxisDisplayMode.Both:
ShowAxisX = true;
ShowAxisY = true;
break;
case AxisDisplayMode.None:
ShowAxisX = false;
ShowAxisY = false;
break;
case AxisDisplayMode.XAxis:
ShowAxisX = true;
ShowAxisY = false;
break;
case AxisDisplayMode.YAxis:
ShowAxisX = false;
ShowAxisY = true;
break;
default:
throw new ArgumentOutOfRangeException();
}
}
}
}
}

0 comments on commit 680d0ff

Please sign in to comment.