Skip to content

Commit

Permalink
Add warning if ffmpeg.exe file not found. (#5)
Browse files Browse the repository at this point in the history
* Add warning if ffmpeg.exe file not found.
Update version to 0.1.0.1.
Update Nugets references to the newest version.
Set default decimal places to 3.
Update documentation index.md, CVS to CSV.
Add and fix some links.

* Update documentation

Update documentation
  • Loading branch information
yoyokits authored Sep 29, 2021
1 parent 45e69ae commit fd4135d
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 25 deletions.
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,28 @@ The screenshot of Bar Chart Race Generator

The more complete documentation can be read in the [Bar Chart Race Website](https://yoyokits.github.io/BarChartRaceNet/).

{% include youtube_embed.html id="Xtnz7N6mwX4" %}
The video example of Bar Chart Race output
The video example of Bar Chart Race output: [Youtube example](https://www.youtube.com/watch?v=onQ0V4cIgMQ)

The input of for this application is CVS files that can be exported from your Excell sheet or simply created using Notepad.<br/>
The input of for this application is CSV files that can be exported from your Excell sheet or simply created using Notepad.<br/>

The CVS example can be downloaded from [CVS example](https://github.com/yoyokits/BarChartRaceNet/tree/master/docs/examples).
The CVS example can be downloaded from [CSV example](https://github.com/yoyokits/BarChartRaceNet/tree/master/docs/examples).

The cvs file is like:
The CSV file is like:

<img src="https://yoyokits.github.io/BarChartRaceNet/images/CsvSourceExample.jpg"><br/>

Installation:<br/>
1. [Download the latest release in zip file.](https://github.com/yoyokits/BarChartRaceNet/releases)
2. Extract the zip file in the Program Files or your favourite folder
3. Simply double click BarChartRaceNet.exe

Usages:
1. Double click BarChartRaceNet.exe
2. Click load button on the top left of the window
3. Select the csv file with format above
4. Adjust the settings like add icon for every bar and background
5. Generate the bar chart race animation in a MPEG format by clicking Export to Video button on the right side of load button
6. Select the output folder and file name and press Save
7. Wait until the process is done

If you have a problem please ask me in [Facebook StatAnim Page](https://www.facebook.com/StatAnim-106525391163002) or open an issue here.
10 changes: 6 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ Bar Chart Race is a free application used to visualize the progress of some deve
The screenshot of Bar Chart Race Generator

{% include youtube_embed.html id="Xtnz7N6mwX4" %}
The video example of Bar Chart Race output
The video example of Bar Chart Race output: [Youtube example](https://www.youtube.com/watch?v=onQ0V4cIgMQ)

The input of for this application is CVS files that can be exported from your Excell sheet or simply created using Notepad.<br/>
The input of for this application is CSV files that can be exported from your Excell sheet or simply created using Notepad.<br/>

The CVS example can be downloaded from [CVS example](https://github.com/yoyokits/BarChartRaceNet/tree/master/docs/examples).
The CSV example can be downloaded from [CSV example](https://github.com/yoyokits/BarChartRaceNet/tree/master/docs/examples).

The cvs file is like:
The CSV file is like:

<img src="https://yoyokits.github.io/BarChartRaceNet/images/CsvSourceExample.jpg"><br/>

Expand All @@ -29,3 +29,5 @@ Usages:
5. Generate the bar chart race animation in a MPEG format by clicking Export to Video button on the right side of load button
6. Select the output folder and file name and press Save
7. Wait until the process is done

If you have a problem please ask me in [Facebook StatAnim Page](https://www.facebook.com/StatAnim-106525391163002) or open an issue here.
17 changes: 14 additions & 3 deletions src/BarChartRaceNet.Test/BarChartRaceNet.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@

<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>

<Version>0.1.0</Version>
<Version>0.1.0.1</Version>

<RepositoryUrl>https://github.com/yoyokits/BarChartRaceNet</RepositoryUrl>

<Company>Cekli</Company>

<PackageProjectUrl>https://github.com/yoyokits/BarChartRaceNet</PackageProjectUrl>

<RepositoryType>git</RepositoryType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -33,11 +41,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="FluentAssertions" Version="6.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
<PackageReference Include="coverlet.collector" Version="1.2.0" />
<PackageReference Include="coverlet.collector" Version="3.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
11 changes: 8 additions & 3 deletions src/BarChartRaceNet/BarChartRaceNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<Platforms>AnyCPU;x64</Platforms>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<Version>0.1.0.1</Version>
<Company>Cekli</Company>
<PackageProjectUrl>https://github.com/yoyokits/BarChartRaceNet</PackageProjectUrl>
<RepositoryUrl>https://github.com/yoyokits/BarChartRaceNet</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -18,10 +23,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CsvHelper" Version="26.1.0" />
<PackageReference Include="FFMpegCore" Version="4.1.0" />
<PackageReference Include="CsvHelper" Version="27.1.1" />
<PackageReference Include="FFMpegCore" Version="4.5.0" />
<PackageReference Include="log4net" Version="2.0.12" />
<PackageReference Include="MahApps.Metro" Version="2.4.4" />
<PackageReference Include="MahApps.Metro" Version="2.4.7" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Ookii.Dialogs.Wpf.NETCore" Version="2.2.1" />
</ItemGroup>
Expand Down
21 changes: 21 additions & 0 deletions src/BarChartRaceNet/Helpers/FFMpegHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,27 @@
/// </summary>
public static class FFMpegHelper
{
#region Properties

/// <summary>
/// Gets the FFMpegLib.
/// </summary>
public static string FFMpegLib { get; } = "ffmpeg.exe";

/// <summary>
/// Gets a value indicating whether IsFFMpegLibExist.
/// </summary>
public static bool IsFFMpegLibExist
{
get
{
var exist = File.Exists(FFMpegLib);
return exist;
}
}

#endregion Properties

#region Methods

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/BarChartRaceNet/Helpers/SettingsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static string GetImageUrl(this IDictionary<string, string> stringToImageU
/// <returns>The <see cref="SettingsModel"/>.</returns>
internal static SettingsModel Load()
{
Logger.Info($"Loading Browser setting {UserJsonSettingsPath}");
Logger.Info($"Loading {AppEnvironment.LongName} setting {UserJsonSettingsPath}");
if (!File.Exists(UserJsonSettingsPath))
{
return null;
Expand All @@ -87,7 +87,7 @@ internal static SettingsModel Load()
}
catch (Exception e)
{
Logger.Error($"Error Loading Browser Setting: {e.Message}");
Logger.Error($"Error Loading {AppEnvironment.LongName} Setting: {e.Message}");
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion src/BarChartRaceNet/Models/SettingsModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class SettingsModel
/// <summary>
/// Gets or sets the DecimalPlaces.
/// </summary>
public int DecimalPlaces { get; set; }
public int DecimalPlaces { get; set; } = 3;

/// <summary>
/// Gets or sets the InitialDirectory.
Expand Down
15 changes: 12 additions & 3 deletions src/BarChartRaceNet/ViewModels/ChartEditorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,17 @@ internal void CancelRendering()
/// <summary>
/// The OnExportChart.
/// </summary>
internal void ExportChart()
internal async void ExportChart()
{
if (!FFMpegHelper.IsFFMpegLibExist)
{
var title = $"FFMpeg Library {FFMpegHelper.FFMpegLib} Not Found";
var message = $"Please download {FFMpegHelper.FFMpegLib} from https://ffbinaries.com/downloads," +
$" extract and copy to the application path.";
await this.GlobalData.ShowMessageAsync(title, message);
return;
}

var fileName = $"{this.BarChartViewModel.Title}.mp4";
var dialog = new VistaSaveFileDialog
{
Expand All @@ -123,15 +132,15 @@ internal void ExportChart()
this.RenderCancellationTokenSource?.Cancel();
this.RenderCancellationTokenSource = new CancellationTokenSource();
var token = this.RenderCancellationTokenSource.Token;
Task.Run(() =>
await Task.Run(async () =>
{
try
{
FFMpegHelper.Record(filePath, this.BarChartView, this.OnDrawChart, this.BarAnimationModel.FrameCount, token);
}
catch (Exception e)
{
this.GlobalData.ShowMessageAsync($"Export Failed", $"Error: {e.Message}");
await this.GlobalData.ShowMessageAsync($"Export Failed", $"Error: {e.Message}\r\n{e.StackTrace}");
}
}, token);
}
Expand Down
8 changes: 6 additions & 2 deletions src/BarChartRaceNet/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;

Expand Down Expand Up @@ -113,8 +114,11 @@ private void OnClosing(object obj)
/// </summary>
private void OnExportChart()
{
this.CancelRenderingButton.IsEnabled = true;
this.ChartEditorViewModel.ExportChart();
Task.Run(() =>
{
this.CancelRenderingButton.IsEnabled = true;
this.ChartEditorViewModel.ExportChart();
});
}

/// <summary>
Expand Down
8 changes: 6 additions & 2 deletions src/BarChartRaceNetTestApp/BarChartRaceNetTestApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<Version>0.1.0</Version>
<Version>0.1.0.1</Version>
<Platforms>AnyCPU;x64</Platforms>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<Company>Cekli</Company>
<RepositoryUrl>https://github.com/yoyokits/BarChartRaceNet</RepositoryUrl>
<PackageProjectUrl>https://github.com/yoyokits/BarChartRaceNet</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -29,7 +33,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MahApps.Metro" Version="2.4.4" />
<PackageReference Include="MahApps.Metro" Version="2.4.7" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit fd4135d

Please sign in to comment.