Skip to content

Commit

Permalink
Merge pull request #433 from LayTec-AG/feature/event-for-3d-plots
Browse files Browse the repository at this point in the history
Use object instead of int for point index (Breaking Change)
  • Loading branch information
sean-mcl committed Jun 17, 2024
2 parents ca01195 + a87001b commit d04403f
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Plotly.Blazor.Generator/src/Interop/EventDataPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ public class EventDataPoint
public int TraceIndex { get; set; }

/// <summary>
/// The zero based index of the point.
/// The zero based index as an object to be compatible to multiple data types.
/// </summary>
public int PointIndex { get; set; }
public object PointIndex { get; set; }

/// <summary>
/// The zero-based point number. Can be used to identify the point in combination with CurveNumber.
Expand Down
8 changes: 8 additions & 0 deletions Plotly.Blazor.Generator/src/Interop/RelayoutEventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,13 @@ public class RelayoutEventData
/// In some cases this may be not be set.
/// </remarks>
public object[] YRange { get; set; }

/// <summary>
/// The z-axis of the layout. [z0, z1].
/// </summary>
/// <remarks>
/// In some cases this may be not be set.
/// </remarks>
public object[] ZRange { get; set; }
}
}
4 changes: 2 additions & 2 deletions Plotly.Blazor/Interop/EventDataPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ public class EventDataPoint
public int TraceIndex { get; set; }

/// <summary>
/// The zero based index of the point.
/// The zero based index as an object to be compatible to multiple data types.
/// </summary>
public int PointIndex { get; set; }
public object PointIndex { get; set; }

/// <summary>
/// The zero-based point number. Can be used to identify the point in combination with CurveNumber.
Expand Down
10 changes: 9 additions & 1 deletion Plotly.Blazor/Interop/RelayoutEventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,13 @@ public class RelayoutEventData
/// In some cases this may be not be set.
/// </remarks>
public object[] YRange { get; set; }

/// <summary>
/// The z-axis of the layout. [z0, z1].
/// </summary>
/// <remarks>
/// In some cases this may be not be set.
/// </remarks>
public object[] ZRange { get; set; }
}
}
}
2 changes: 1 addition & 1 deletion Plotly.Blazor/Plotly.Blazor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@
</member>
<member name="P:Plotly.Blazor.Interop.EventDataPoint.PointIndex">
<summary>
The zero based index of the point.
The zero based index as an object to be compatible to multiple data types.
</summary>
</member>
<member name="P:Plotly.Blazor.Interop.EventDataPoint.PointNumber">
Expand Down
8 changes: 8 additions & 0 deletions Plotly.Blazor/wwwroot/plotly-interop-2.33.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ export function subscribeRelayoutEvent(dotNetObj, id) {
var y1 = data["yaxis.range[0]"]
var y2 = data["yaxis.range[1]"]

var z1 = data["zaxis.range[0]"]
var z2 = data["zaxis.range[1]"]

var result = {};

if (x1 && x2) {
Expand All @@ -230,6 +233,11 @@ export function subscribeRelayoutEvent(dotNetObj, id) {
if (y1 && y2) {
result.YRange = [y1, y2];
}

if (z1 && z2) {
result.ZRange = [z1, z2];
}

dotNetObj.invokeMethodAsync('RelayoutEvent', result);
});
}

0 comments on commit d04403f

Please sign in to comment.