-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #366 from LayTec-AG/release/3.0.0
Release/3.0.0
- Loading branch information
Showing
43 changed files
with
3,538 additions
and
1,915 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
@using Plotly.Blazor.Interop | ||
@using Plotly.Blazor.LayoutLib | ||
@using Plotly.Blazor.Traces.ScatterLib | ||
|
||
<PlotlyChart style="height: 60vh; min-height: 350px" | ||
@bind-Config="config" @bind-Layout="layout" @bind-Data="data" @ref="chart" | ||
ClickAction="ClickAction" AfterRender="SubscribeEvents" /> | ||
|
||
@if (ClickInfos != null && ClickInfos.Any()) | ||
{ | ||
<MudText>Current X: @ClickInfos.First().X</MudText> | ||
<MudText>Current Y: @ClickInfos.FirstOrDefault(d => d.TraceIndex == 0)?.Y</MudText> | ||
<MudText>Current Y2: @ClickInfos.FirstOrDefault(d => d.TraceIndex == 1)?.Y</MudText> | ||
} | ||
|
||
@code | ||
{ | ||
[CascadingParameter] | ||
private MudTheme Theme { get; set; } | ||
|
||
private PlotlyChart chart; | ||
private Config config; | ||
private Layout layout; | ||
private IList<ITrace> data; | ||
private IEnumerable<EventDataPoint> ClickInfos { get; set; } | ||
|
||
/// <inheritdoc /> | ||
protected override void OnInitialized() | ||
{ | ||
config = new Config | ||
{ | ||
Responsive = true | ||
}; | ||
|
||
layout = new Layout | ||
{ | ||
Title = new Title | ||
{ | ||
Text = GetType().Name | ||
}, | ||
PaperBgColor = Theme.PaletteDark.Surface.ToString(), | ||
PlotBgColor = Theme.PaletteDark.Surface.ToString(), | ||
Font = new Font | ||
{ | ||
Color = Theme.PaletteDark.TextPrimary.ToString() | ||
}, | ||
HoverMode = HoverModeEnum.XUnified | ||
}; | ||
|
||
data = new List<ITrace> | ||
{ | ||
new Scatter | ||
{ | ||
Name = "ScatterTrace", | ||
Mode = ModeFlag.Markers, | ||
X = Enumerable.Range(0, 30).Cast<object>().ToList(), | ||
Y = Helper.GenerateData(0, 30).Y | ||
}, | ||
new Scatter | ||
{ | ||
Name = "ScatterTrace 2", | ||
Mode = ModeFlag.Markers, | ||
X = Enumerable.Range(0, 30).Cast<object>().ToList(), | ||
Y = Helper.GenerateData(0, 30).Y | ||
} | ||
}; | ||
|
||
base.OnInitialized(); | ||
} | ||
|
||
public void ClickAction(IEnumerable<EventDataPoint> eventData) | ||
{ | ||
ClickInfos = eventData; | ||
StateHasChanged(); | ||
} | ||
|
||
public async void SubscribeEvents() | ||
{ | ||
await chart.SubscribeClickEvent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@page "/click" | ||
|
||
<Example Title="Scatter Chart with Click-Event" Url="Plotly.Blazor.Examples/Components/Click.razor"> | ||
<Click/> | ||
</Example> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.