Skip to content

Commit 3da1307

Browse files
committed
Remove Unmashalled code
1 parent 6adc81a commit 3da1307

File tree

5 files changed

+5
-62
lines changed

5 files changed

+5
-62
lines changed

docs/BlazorApexCharts.Docs/Components/Features/Performance/Basic.razor

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44

55

6-
<ItemSelect Label="JS Interop Strategy" Items="@(EnumHelper.GetList<JSInteropStrategy>())" @bind-SelectedValue="@jsInteropStrategy" Changed=LoadData />
76

87
<ItemSelect Label="Datapoints" Items=points @bind-SelectedValue=pointsToLoad Changed=LoadData />
98

@@ -12,10 +11,8 @@
1211
Title="Value"
1312
Height="150"
1413
XAxisType="XAxisType.Datetime"
15-
JSInteropStrategy=jsInteropStrategy
1614
@ref=chart>
1715

18-
1916
<ApexPointSeries TItem="TimeSeries"
2017
Items="timeSeries.Take(pointsToLoad)"
2118
Name="Value"
@@ -37,9 +34,8 @@ else
3734

3835

3936
@code {
40-
private JSInteropStrategy jsInteropStrategy = JSInteropStrategy.UnMarshalled;
4137
private ApexChart<TimeSeries> chart;
42-
private List<int> points = new List<int> { 100, 1000, 5000, 10000,25000 };
38+
private List<int> points = new List<int> { 100, 1000, 5000, 10000, 15000, 20000 };
4339
private int pointsToLoad = 100;
4440
private List<TimeSeries> timeSeries = new TimeSeriesGenerator(25000).TimeSeries;
4541
private string message;

src/Blazor-ApexCharts/ApexChart.razor.cs

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public partial class ApexChart<TItem> : IDisposable where TItem : class
2020
[Parameter] public string Title { get; set; }
2121
[Parameter] public XAxisType? XAxisType { get; set; }
2222
[Parameter] public bool Debug { get; set; }
23-
[Parameter] public JSInteropStrategy JSInteropStrategy { get; set; }
2423
[Parameter] public object Width { get; set; }
2524
[Parameter] public object Height { get; set; }
2625
[Parameter] public EventCallback<SelectedData<TItem>> OnDataPointSelection { get; set; }
@@ -39,20 +38,9 @@ public partial class ApexChart<TItem> : IDisposable where TItem : class
3938
private bool forceRender = true;
4039
private string chartId;
4140
public string ChartId => ChartId;
42-
private IJSUnmarshalledRuntime jsUnmarshalled;
43-
private IJSInProcessRuntime jsInprocess;
4441

45-
private bool isWasm;
4642

47-
protected override void OnInitialized()
48-
{
49-
isWasm = JSRuntime is IJSInProcessRuntime;
50-
if (isWasm)
51-
{
52-
jsInprocess = (IJSInProcessRuntime)JSRuntime;
53-
jsUnmarshalled = (IJSUnmarshalledRuntime)ServiceProvider.GetService(typeof(IJSUnmarshalledRuntime));
54-
}
55-
}
43+
5644

5745
protected override async Task OnAfterRenderAsync(bool firstRender)
5846
{
@@ -354,37 +342,10 @@ public async Task UpdateOptionsAsync(bool redrawPaths, bool animate, bool update
354342

355343
public async Task UpdateSeriesAsync(bool animate = true)
356344
{
357-
var sw = new Stopwatch();
358-
sw.Start();
359-
360345
SetSeries();
361-
Console.WriteLine($"SetSeries {sw.ElapsedMilliseconds}");
362346
UpdateDataForNoAxisCharts();
363-
Console.WriteLine($"UpdateDataForNoAxisCharts {sw.ElapsedMilliseconds}");
364347
var jsonSeries = Serialize(Options.Series);
365-
Console.WriteLine($"Serialize {sw.ElapsedMilliseconds}");
366-
367-
368-
if (jsUnmarshalled != null && JSInteropStrategy == JSInteropStrategy.UnMarshalled)
369-
{
370-
jsUnmarshalled.InvokeUnmarshalled<string, string, string, string>("blazor_apexchart.testUnmarshalled", Options.Chart.Id, jsonSeries, animate.ToString().ToLower());
371-
Console.WriteLine($"Invoke Unmarshalled {sw.ElapsedMilliseconds}");
372-
373-
}
374-
else if (jsInprocess != null && JSInteropStrategy == JSInteropStrategy.Sync)
375-
{
376-
jsInprocess.InvokeVoid("blazor_apexchart.updateSeries", Options.Chart.Id, jsonSeries, animate);
377-
Console.WriteLine($"Invoke Sync {sw.ElapsedMilliseconds}");
378-
379-
}
380-
else
381-
{
382-
await JSRuntime.InvokeVoidAsync("blazor_apexchart.updateSeries", Options.Chart.Id, jsonSeries, animate);
383-
Console.WriteLine($"Invoke Async {sw.ElapsedMilliseconds}");
384-
385-
}
386-
387-
sw.Stop();
348+
await JSRuntime.InvokeVoidAsync("blazor_apexchart.updateSeries", Options.Chart.Id, jsonSeries, animate);
388349
}
389350

390351

src/Blazor-ApexCharts/Blazor-ApexCharts.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<PackageTags>Blazor Charts ApexCharts</PackageTags>
1111
<RepositoryUrl>https://github.com/apexcharts/Blazor-ApexCharts</RepositoryUrl>
1212
<PackageProjectUrl>https://apexcharts.github.io/Blazor-ApexCharts/</PackageProjectUrl>
13-
<Copyright>Copyright 2020 (c) Joakim Dangården. All rights reserved.</Copyright>
13+
<Copyright>Copyright 2022 (c) Joakim Dangården. All rights reserved.</Copyright>
1414
</PropertyGroup>
1515

1616

src/Blazor-ApexCharts/Models/JSInteropStrategy.cs

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/Blazor-ApexCharts/wwwroot/js/blazor-apex-charts.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
window.blazor_apexchart = {
22

3-
testUnmarshalled(id, series, animate) {
4-
var chartAnimate = (BINDING.conv_string(animate).toLowerCase() === 'true');
5-
this.updateSeries(BINDING.conv_string(id), BINDING.conv_string(series), chartAnimate);
6-
},
7-
3+
84
getYAxisLabel(value, index, w) {
95

106
if (window.wasmBinaryFile === undefined) {

0 commit comments

Comments
 (0)