Skip to content

Commit

Permalink
Merge pull request #370 from LayTec-AG/release/4.0.0
Browse files Browse the repository at this point in the history
Release/4.0.0
  • Loading branch information
sean-mcl authored Oct 21, 2023
2 parents dd097e2 + 9d587ee commit 61a23a1
Show file tree
Hide file tree
Showing 2,350 changed files with 3,344 additions and 2,706 deletions.

This file was deleted.

8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
- name: Build with dotnet
run: dotnet build --configuration Release
- name: Test with dotnet
run: dotnet test
run: dotnet test
6 changes: 5 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
- name: Build with dotnet
run: dotnet build --configuration Release
- name: Test with dotnet
Expand Down
40 changes: 40 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<GlobalPackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</GlobalPackageReference>
</ItemGroup>

<ItemGroup>
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="all" />
</ItemGroup>

<ItemGroup >
<PackageVersion Condition="'$(TargetFramework)' == 'net6.0'" Include="Microsoft.AspNetCore.Components" Version="6.0.23" />
<PackageVersion Condition="'$(TargetFramework)' == 'net6.0'" Include="Microsoft.AspNetCore.Components.Web" Version="6.0.23" />
<PackageVersion Condition="'$(TargetFramework)' == 'net6.0'" Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.23" />
<PackageVersion Condition="'$(TargetFramework)' == 'net6.0'" Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.23" PrivateAssets="all" />

<PackageVersion Condition="'$(TargetFramework)' == 'net7.0'" Include="Microsoft.AspNetCore.Components" Version="7.0.12" />
<PackageVersion Condition="'$(TargetFramework)' == 'net7.0'" Include="Microsoft.AspNetCore.Components.Web" Version="7.0.12" />
<PackageVersion Condition="'$(TargetFramework)' == 'net7.0'" Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.12" />
<PackageVersion Condition="'$(TargetFramework)' == 'net7.0'" Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.12" PrivateAssets="all" />

<PackageVersion Include="MudBlazor" Version="6.11.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="PublishSPAforGitHubPages.Build" Version="2.1.0" />

<PackageVersion Include="Stubble.Core" Version="1.10.8" />
<PackageVersion Include="WeCantSpell.Hunspell" Version="4.0.0" />

<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="nunit" Version="3.13.3" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
</ItemGroup>
</Project>
47 changes: 6 additions & 41 deletions Plotly.Blazor.Examples/Components/Relayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
@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"
RelayoutAction="RelayoutAction" AfterRender="Init"/>
@bind-Config="config" @bind-Layout="layout" @bind-Data="data" @ref="chart"
RelayoutAction="RelayoutAction" AfterRender="Init" />

@if (relayoutData?.XRange?.Count() == 2)
{
Expand All @@ -29,6 +29,8 @@
/// <inheritdoc />
protected override void OnInitialized()
{
var startDate = DateTime.Now;

config = new Config
{
Responsive = true
Expand Down Expand Up @@ -61,56 +63,19 @@
{
Name = "ScatterTrace",
Mode = ModeFlag.Lines | ModeFlag.Markers,
X = new List<object>(),
Y = new List<object>()
X = Enumerable.Range(0, 100).Select(i => startDate + TimeSpan.FromHours(i)).Cast<object>().ToList(),
Y = Helper.GenerateData(0, 100).Y
}
};

base.OnInitialized();
}

protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await ExtendData();
}
}

private async void Init()
{
await ExtendData();
await chart.SubscribeRelayoutEvent();
}

private async Task ExtendData(int count = 100)
{
if (chart.Data.FirstOrDefault() is not Scatter scatter) return;

var max = (int?)scatter.X?.Max();
var (_, y) = Helper.GenerateData(max + 1 ?? 0, max + 1 + count ?? count);

var xDate = new DateTime(2015, 2, 12);
var x = new List<object>();

for (int i = 0; i < count; i++)
{
x.Add(xDate);
xDate = xDate.AddHours(1);
}

if (!scatter.X.Any() || !scatter.Y.Any())
{
scatter.X.AddRange(x);
scatter.Y.AddRange(y);
await chart.React();
}
else
{
await chart.ExtendTrace(x, y, data.IndexOf(scatter));
}
}

public void RelayoutAction(RelayoutEventData data)
{
relayoutData = data;
Expand Down
79 changes: 36 additions & 43 deletions Plotly.Blazor.Examples/Plotly.Blazor.Examples.csproj
Original file line number Diff line number Diff line change
@@ -1,45 +1,38 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<GHPages>true</GHPages>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.21" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.21" PrivateAssets="all" />
<PackageReference Include="MudBlazor" Version="6.8.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="PublishSPAforGitHubPages.Build" Version="2.1.0" />
<PackageReference Include="System.Reactive" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Plotly.Blazor\Plotly.Blazor.csproj" />
</ItemGroup>

<ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
</ItemGroup>

<ItemGroup>
<Content Update="wwwroot\2011_february_aa_flight_paths.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\js\highlight.min.js">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\js\interop.js">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\mt_bruno_elevation.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<Folder Include="wwwroot\css\highlight\" />
</ItemGroup>
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
<GHPages>true</GHPages>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly"/>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer"/>
<PackageReference Include="MudBlazor" />
<PackageReference Include="Newtonsoft.Json"/>
<PackageReference Include="PublishSPAforGitHubPages.Build"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Plotly.Blazor\Plotly.Blazor.csproj" />
</ItemGroup>
<ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
</ItemGroup>
<ItemGroup>
<Content Update="wwwroot\2011_february_aa_flight_paths.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\js\highlight.min.js">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\js\interop.js">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
<Content Update="wwwroot\mt_bruno_elevation.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\css\highlight\" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Plotly.Blazor.Examples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

builder
.Services
.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://raw.githubusercontent.com/LayTec-AG/Plotly.Blazor/main/") });
.AddScoped(_ => new HttpClient { BaseAddress = new Uri("https://raw.githubusercontent.com/LayTec-AG/Plotly.Blazor/main/") });

builder.Services.AddMudServices(config =>
{
Expand Down
12 changes: 5 additions & 7 deletions Plotly.Blazor.Generator/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ public static class Helper
/// Dictionary to customize the pascal casing for specific words.
/// </summary>
/// <value>The custom words.</value>
private static Dictionary<string, string> CustomWords { get; set; } = File.ReadAllLines("CustomDic.txt")
private static Dictionary<string, string> CustomWords { get; } = File.ReadAllLines("CustomDic.txt")
.Select(l =>
{
var keyValue = l.Split('=');
return (keyValue[0], keyValue[1]);
})
.ToDictionary(k => k.Item1, v => v.Item2);


/// <summary>
/// Converts the input to camelcase. Default: PascalCase
/// </summary>
Expand Down Expand Up @@ -84,17 +83,17 @@ public static string ToCamelCase(this string input, WordList dic, bool suppressU
.FirstOrDefault();

// If there is a suggestion, override the default
if (suggestions != null && suggestions.Length > 0)
if (suggestions?.Length > 0)
{
//var suggestions = suggestionList[maxIndex];
suggestion = suggestions.Where(s => !string.IsNullOrWhiteSpace(s))
.Select((s, i) =>
{
if (i == 0)
{
return suppressUppercase ? s : $"{char.ToUpper(s[0])}{s.Substring(1)}";
return suppressUppercase ? s : $"{char.ToUpper(s[0])}{s[1..]}";
}
return $"{char.ToUpper(s[0])}{s.Substring(1)}";
return $"{char.ToUpper(s[0])}{s[1..]}";
})
.Aggregate((s, t) => $"{s}{t}");
}
Expand All @@ -103,7 +102,7 @@ public static string ToCamelCase(this string input, WordList dic, bool suppressU
UnknownWords.Add(input);
}
}
return suppressUppercase ? suggestion : $"{char.ToUpper(suggestion[0])}{suggestion.Substring(1)}";
return suppressUppercase ? suggestion : $"{char.ToUpper(suggestion[0])}{suggestion[1..]}";
}

/// <summary>
Expand Down Expand Up @@ -199,7 +198,6 @@ private static string ReplaceSpecialChars(this string input)
return sb.ToString();
}


/// <summary>
/// Splits the given string by character count. Splits only full words.
/// </summary>
Expand Down
Loading

0 comments on commit 61a23a1

Please sign in to comment.