├── .gitattributes ├── .gitignore ├── BlazorComponents.sln ├── NOTES.md ├── README.md ├── azure-pipelines.yml ├── barchart.png ├── changelog.md ├── linechart.png ├── samples └── TestApplication │ ├── App.cshtml │ ├── Pages │ ├── Index - Copy.cshtml │ ├── Index.cshtml │ ├── LineChart.cshtml │ ├── MutipleCharts.cshtml │ ├── PieChart.cshtml │ ├── RadarChart.cshtml │ └── _ViewImports.cshtml │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── Shared │ ├── MainLayout.cshtml │ ├── NavMenu.cshtml │ └── SurveyPrompt.cshtml │ ├── Startup.cs │ ├── TestApplication.csproj │ ├── _ViewImports.cshtml │ └── wwwroot │ ├── css │ ├── bootstrap │ │ ├── bootstrap-native.min.js │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ ├── open-iconic │ │ ├── FONT-LICENSE │ │ ├── ICON-LICENSE │ │ ├── README.md │ │ └── font │ │ │ ├── css │ │ │ └── open-iconic-bootstrap.min.css │ │ │ └── fonts │ │ │ ├── open-iconic.eot │ │ │ ├── open-iconic.otf │ │ │ ├── open-iconic.svg │ │ │ ├── open-iconic.ttf │ │ │ └── open-iconic.woff │ └── site.css │ ├── index.html │ └── sample-data │ └── weather.json └── src └── BlazorComponents ├── BlazorComponents.csproj ├── ChartJS ├── ChartJSBarChart.cs ├── ChartJSInterop.cs ├── ChartJSLineChart.cs ├── ChartJSPieChart.cs ├── ChartJSRadarChart.cs ├── ChartJSRadarDataset.cs ├── ChartJsBarData.cs ├── ChartJsBarDataset.cs ├── ChartJsData.cs ├── ChartJsDataLabels.cs ├── ChartJsDataLabelsFont.cs ├── ChartJsDataset.cs ├── ChartJsLayout.cs ├── ChartJsLegend.cs ├── ChartJsLineData.cs ├── ChartJsLineDataset.cs ├── ChartJsOptions.cs ├── ChartJsPadding.cs ├── ChartJsPieData.cs ├── ChartJsPieDataset.cs ├── ChartJsPlugins.cs ├── ChartJsRadarData.cs ├── ChartJsScale.cs ├── ChartJsTicks.cs ├── ChartJsTitle.cs ├── ChartJsXAxes.cs ├── ChartJsyAxes.cs ├── ChartTypes.cs └── IChart.cs ├── Properties └── launchSettings.json ├── Shared ├── ChartBase.cs ├── ChartJsBarChart.cshtml ├── ChartJsLineChart.cshtml ├── ChartJsPieChart.cshtml └── ChartJsRadarChart.cshtml └── dist └── BlazorComponents.js /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc -------------------------------------------------------------------------------- /BlazorComponents.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26124.0 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{08E01108-AF62-4E37-824D-0A22DA1988C3}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{5474F748-8E27-4FD6-AD9D-1087578ED4D7}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorComponents", "src\BlazorComponents\BlazorComponents.csproj", "{1990A3D7-7B00-469F-BC97-F614393F7A52}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApplication", "samples\TestApplication\TestApplication.csproj", "{6926AB76-E1D0-43EA-851A-4FB3660D15A9}" 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {1990A3D7-7B00-469F-BC97-F614393F7A52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {1990A3D7-7B00-469F-BC97-F614393F7A52}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {1990A3D7-7B00-469F-BC97-F614393F7A52}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {1990A3D7-7B00-469F-BC97-F614393F7A52}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {6926AB76-E1D0-43EA-851A-4FB3660D15A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {6926AB76-E1D0-43EA-851A-4FB3660D15A9}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {6926AB76-E1D0-43EA-851A-4FB3660D15A9}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {6926AB76-E1D0-43EA-851A-4FB3660D15A9}.Release|Any CPU.Build.0 = Release|Any CPU 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | GlobalSection(NestedProjects) = preSolution 33 | {1990A3D7-7B00-469F-BC97-F614393F7A52} = {08E01108-AF62-4E37-824D-0A22DA1988C3} 34 | {6926AB76-E1D0-43EA-851A-4FB3660D15A9} = {5474F748-8E27-4FD6-AD9D-1087578ED4D7} 35 | EndGlobalSection 36 | GlobalSection(ExtensibilityGlobals) = postSolution 37 | SolutionGuid = {6B9B5C87-8AF0-4846-81C5-798F5C654FB6} 38 | EndGlobalSection 39 | EndGlobal 40 | -------------------------------------------------------------------------------- /NOTES.md: -------------------------------------------------------------------------------- 1 | ## 0.4.0 2 | 3 | There are a few changes in 0.4 that you should be aware of before you upgrade your project. 4 | 5 | ### Breaking Changes 6 | 7 | In previous releases you would declare a chart as follows: 8 | 9 | ```csharp 10 | blazorBarChartJS = new ChartJSChart() 11 | { 12 | ... 13 | Data = new ChartJsData() 14 | { 15 | ... 16 | Datasets = new List() 17 | { 18 | new ChartJsBarDataset() 19 | { 20 | Label = "# of Votes from blazor", 21 | BackgroundColor = "#cc65fe", 22 | Data = new List(){ 19,12,5,3,3,2} 23 | }, 24 | new ChartJsBarDataset() 25 | { 26 | Label = "# of Likes from blazor", 27 | BackgroundColor = "#36a2eb", 28 | Data = new List(){ 30,10,15,13,13,12} 29 | } 30 | } 31 | } 32 | }; 33 | ``` 34 | 35 | I have moved things around to get rid of the generic chart declaration. So the new declaration will look as follows: 36 | 37 | ```csharp 38 | blazorBarChartJS = new ChartJSBarChart() 39 | { 40 | ... 41 | Data = new ChartJsBarData() 42 | { 43 | ... 44 | Datasets = new List() 45 | { 46 | new ChartJsBarDataset() 47 | { 48 | Label = "# of Votes from blazor", 49 | BackgroundColor = new List(){"#cc65fe" }, 50 | ... ... 51 | Data = new List(){ 19.187,12.2253,5.5,3,3,2} 52 | }, 53 | new ChartJsBarDataset() 54 | { 55 | Label = "# of Likes from blazor", 56 | BackgroundColor = new List() { 57 | "#a4cef0", 58 | "#3498db", ...}, 59 | ... ... 60 | Data = new List(){ 30,10,15,13,13,12}.Select(i=> i).ToList() 61 | } 62 | } 63 | } 64 | }; 65 | ``` 66 | 67 | Look at this [sample](https://github.com/muqeet-khan/BlazorComponents/blob/master/samples/TestApplication/Pages/Index.cshtml) for a complete example. 68 | 69 | You will notice there are a couple of other changes. 70 | 71 | 1. BackgroundColor is now a `List` instead of `string`. 72 | 2. Data is now a double instead of int. 73 | 74 | The `backgroundcolor` property was changed to accomodate a larger set of scenarios than was possible with previous versions. 75 | 76 | Data was made double as well to accomodate a larger set of scenarios. 77 | 78 | 79 | Because of the dynamic nature and possibility in JS, ChartJS has multiple types assigned to some of their proerpties as a result what works OOB in ChartJS will need some thinking in Blazor. 80 | 81 | ## Important 82 | 83 | There is no need to call the Update methods in the interop when updating the charts. This was done because I did not understand how Blazor was updating JS props. 84 | 85 | 86 | ## Contributions 87 | 88 | ### Thanks 89 | 90 | [@tenickl](https://github.com/tenickl) - For the Piechart update 91 | 92 | [@fische17](https://github.com/fische17) - For the move to Blazor 0.6.0 93 | 94 | [@srowan](https://github.com/srowan) - For the readme update. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Simple Components for Blazor Projects 2 | 3 | ``` 4 | Note: Just as Blazor, this repo is also experimental. 5 | ``` 6 | 7 | If you like the idea of this repo leave your feedback as an issue or star the repo or let me know on [@ma_khan](https://twitter.com/ma_khan) 8 | 9 | Currently, starting with a simple [ChartJS](https://github.com/chartjs/Chart.js) implementation. 10 | 11 | 12 | ## Prerequisites 13 | 14 | Don't know what Blazor is? Read [here](https://github.com/aspnet/Blazor) 15 | 16 | Complete all Blazor dependencies. 17 | 18 | 1. Visual Studio 2017 (15.8 or later) 19 | 2. DotNetCore 2.1 (2.1.402 or later). 20 | 21 | 22 | ## Installation 23 | 24 | ![NuGet](https://img.shields.io/nuget/v/BlazorComponents.svg) ![NuGet Pre Release](https://img.shields.io/nuget/vpre/BlazorComponents.svg) 25 | 26 | 27 | To Install 28 | 29 | ``` 30 | Install-Package BlazorComponents 31 | ``` 32 | or 33 | ``` 34 | dotnet add package BlazorComponents 35 | ``` 36 | 37 | ## Usage 38 | 39 | 1. In cshtml file add this: 40 | 41 | ```html 42 |
43 | 44 |
45 | 46 | ``` 47 | 48 | ```csharp 49 | @functions { 50 | 51 | public ChartJSBarChart blazorBarChartJS { get; set; } = new ChartJSBarChart(); 52 | ChartJsBarChart barChartJs; 53 | 54 | protected override void OnInit() 55 | { 56 | 57 | blazorBarChartJS = new ChartJSBarChart() 58 | { 59 | ChartType = "bar", 60 | CanvasId = "myFirstBarChart", 61 | Options = new ChartJsOptions() 62 | { 63 | Text = "Sample chart from Blazor", 64 | BorderWidth = 1, 65 | Display = true, 66 | // Title of the chart 67 | Title = new ChartJsTitle() 68 | { 69 | Display = true, // Set to false for hiding the title 70 | Text = "Title", 71 | FontSize = 40 72 | }, 73 | Layout = new ChartJsLayout() 74 | { 75 | // add some space to the chart for better rendering 76 | Padding = new ChartJsPadding() 77 | { 78 | Bottom = 0, 79 | Left = 0, 80 | Right = 0, 81 | Top = 50 82 | } 83 | }, 84 | // move the legend 85 | Legend = new ChartJsLegend() 86 | { 87 | Position = "top", 88 | Display = true // set to false for hiding legend 89 | }, 90 | Scales = new ChartJsScale() 91 | { 92 | XAxes = new List() 93 | { 94 | new ChartJsXAxes() 95 | { 96 | Ticks = new ChartJsTicks() 97 | { 98 | BeginAtZero = true, 99 | FontSize = 20 100 | }, 101 | Position = "top" 102 | } 103 | }, 104 | YAxes = new List() 105 | { 106 | new ChartJsYAxes() 107 | { 108 | Ticks = new ChartJsTicks() 109 | { 110 | BeginAtZero = true, 111 | FontSize = 20, 112 | Max = 50 // set a maxmimum value for this axis 113 | } 114 | } 115 | } 116 | }, 117 | Plugins = new ChartJsPlugins() 118 | { 119 | // if you have enabled the plugin you can use these parameters, otherwise it will be ignored 120 | Datalabels = new ChartJsDataLabels() 121 | { 122 | Align = "end", 123 | Anchor = "end", 124 | Color = "black", 125 | Display = true, 126 | Font = new ChartJsDataLabelsFont() 127 | { 128 | Size = 20 129 | } 130 | } 131 | } 132 | }, 133 | Data = new ChartJsBarData() 134 | { 135 | Labels = new List() { "Red", "Blue", "Yellow", "Green", "Purple", "Orange" }, 136 | Datasets = new List() 137 | { 138 | new ChartJsBarDataset() 139 | { 140 | Label = "# of Votes from blazor", 141 | BackgroundColor = new List(){"#cc65fe" }, 142 | BorderColor = "#cc65fe", 143 | PointHoverRadius = 2, 144 | Data = new List(){ 19.187,12.2253,5.5,3,3,2} 145 | }, 146 | new ChartJsBarDataset() 147 | { 148 | Label = "# of Likes from blazor", 149 | BackgroundColor = new List() { 150 | "#a4cef0", 151 | "#3498db", 152 | "#95a5a6", 153 | "#9b59b6", 154 | "#f1c40f", 155 | "#e74c3c", 156 | "#34495e" }, 157 | BorderColor = "#36a2eb", 158 | PointHoverRadius = 2, 159 | Data = new List(){ 30,10,15,13,13,12}.Select(i=> i).ToList() 160 | } 161 | } 162 | } 163 | }; 164 | } 165 | 166 | public async Task UpdateChart() 167 | { 168 | //Update existing dataset 169 | blazorBarChartJS.Data.Labels.Add($"New{DateTime.Now.Second}"); 170 | var firstDataSet = blazorBarChartJS.Data.Datasets[0]; 171 | firstDataSet.Data.Add(DateTime.Now.Second); 172 | 173 | //Add new dataset 174 | //blazorLineChartJS.Data.Datasets.Add(new ChartJsLineDataset() 175 | //{ 176 | // BackgroundColor = "#cc65fe", 177 | // BorderColor = "#cc65fe", 178 | // Label = "# of Votes from blazor 1", 179 | // Data = new List {20,21,12,3,4,4}, 180 | // Fill = true, 181 | // BorderWidth = 2, 182 | // PointRadius = 3, 183 | // PointBorderWidth = 1 184 | //}); 185 | 186 | return true; 187 | } 188 | } 189 | ``` 190 | 191 | 2. In index.html add: 192 | 193 | ```html 194 | 195 | 197 | ``` 198 | 199 | 2.1. For using the data label plugin add this, too: 200 | 201 | ``` html 202 | 203 | ``` 204 | 205 | 3. In _ViewImports.cshtml add: 206 | 207 | ```html 208 | @using BlazorComponents.ChartJS 209 | @using BlazorComponents.Shared 210 | @addTagHelper *,BlazorComponents 211 | ``` 212 | 213 | ## Sample Output 214 | 215 | Bar Chart Example: 216 | ![Barchart](barchart.png) 217 | 218 | 219 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | # ASP.NET Core 2 | # Build and test ASP.NET Core web applications targeting .NET Core. 3 | # Add steps that run tests, create a NuGet package, deploy, and more: 4 | # https://docs.microsoft.com/vsts/pipelines/languages/dotnet-core 5 | 6 | pool: 7 | vmImage: 'VS2017-Win2016' 8 | 9 | variables: 10 | buildConfiguration: 'Release' 11 | 12 | steps: 13 | - script: dotnet build --configuration $(buildConfiguration) 14 | displayName: 'dotnet build $(buildConfiguration)' 15 | -------------------------------------------------------------------------------- /barchart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/muqeet-khan/BlazorComponents/5244263139306eed6329c80ae6c0a4baa931d958/barchart.png -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | ## 0.5.0 2 | 3 | Not many changes in this release. 4 | 5 | 1. Bumped the version of Blazor from 060 to 070. 6 | 2. One merged PR related to beginAtZero in scale. 7 | 8 | ## Contributions 9 | 10 | ### Thanks 11 | 12 | [@pilo11](https://github.com/pilo11) - For the beginAtZero PR 13 | 14 | 15 | ## 0.4.0 16 | 17 | There are a few changes in 0.4 that you should be aware of before you upgrade your project. 18 | 19 | ### Breaking Changes 20 | 21 | In previous releases you would declare a chart as follows: 22 | 23 | ```csharp 24 | blazorBarChartJS = new ChartJSChart() 25 | { 26 | ... 27 | Data = new ChartJsData() 28 | { 29 | ... 30 | Datasets = new List() 31 | { 32 | new ChartJsBarDataset() 33 | { 34 | Label = "# of Votes from blazor", 35 | BackgroundColor = "#cc65fe", 36 | Data = new List(){ 19,12,5,3,3,2} 37 | }, 38 | new ChartJsBarDataset() 39 | { 40 | Label = "# of Likes from blazor", 41 | BackgroundColor = "#36a2eb", 42 | Data = new List(){ 30,10,15,13,13,12} 43 | } 44 | } 45 | } 46 | }; 47 | ``` 48 | 49 | I have moved things around to get rid of the generic chart declaration. So the new declaration will look as follows: 50 | 51 | ```csharp 52 | blazorBarChartJS = new ChartJSBarChart() 53 | { 54 | ... 55 | Data = new ChartJsBarData() 56 | { 57 | ... 58 | Datasets = new List() 59 | { 60 | new ChartJsBarDataset() 61 | { 62 | Label = "# of Votes from blazor", 63 | BackgroundColor = new List(){"#cc65fe" }, 64 | ... ... 65 | Data = new List(){ 19.187,12.2253,5.5,3,3,2} 66 | }, 67 | new ChartJsBarDataset() 68 | { 69 | Label = "# of Likes from blazor", 70 | BackgroundColor = new List() { 71 | "#a4cef0", 72 | "#3498db", ...}, 73 | ... ... 74 | Data = new List(){ 30,10,15,13,13,12}.Select(i=> i).ToList() 75 | } 76 | } 77 | } 78 | }; 79 | ``` 80 | 81 | Look at this [sample](https://github.com/muqeet-khan/BlazorComponents/blob/master/samples/TestApplication/Pages/Index.cshtml) for a complete example. 82 | 83 | You will notice there are a couple of other changes. 84 | 85 | 1. BackgroundColor is now a `List` instead of `string`. 86 | 2. Data is now a double instead of int. 87 | 88 | The `backgroundcolor` property was changed to accomodate a larger set of scenarios than was possible with previous versions. 89 | 90 | Data was made double as well to accomodate a larger set of scenarios. 91 | 92 | 93 | Because of the dynamic nature and possibility in JS, ChartJS has multiple types assigned to some of their proerpties as a result what works OOB in ChartJS will need some thinking in Blazor. 94 | 95 | ## Important 96 | 97 | There is no need to call the Update methods in the interop when updating the charts. This was done because I did not understand how Blazor was updating JS props. 98 | 99 | 100 | ## Contributions 101 | 102 | ### Thanks 103 | 104 | [@tenickl](https://github.com/tenickl) - For the Piechart update 105 | 106 | [@fische17](https://github.com/fische17) - For the move to Blazor 0.6.0 107 | 108 | [@srowan](https://github.com/srowan) - For the readme update. -------------------------------------------------------------------------------- /linechart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/muqeet-khan/BlazorComponents/5244263139306eed6329c80ae6c0a4baa931d958/linechart.png -------------------------------------------------------------------------------- /samples/TestApplication/App.cshtml: -------------------------------------------------------------------------------- 1 |  5 | 6 | -------------------------------------------------------------------------------- /samples/TestApplication/Pages/Index - Copy.cshtml: -------------------------------------------------------------------------------- 1 | @page "/backup" 2 | @using BlazorComponents.Shared 3 | 4 |
5 |

Chart JS charts using Blazor

6 |
7 | 8 |
9 | 10 |
11 | 12 | 13 | @functions { 14 | 15 | public ChartJSBarChart blazorBarChartJS { get; set; } = new ChartJSBarChart(); 16 | ChartJsBarChart barChartJs; 17 | 18 | protected override void OnInit() 19 | { 20 | blazorBarChartJS = new ChartJSBarChart() 21 | { 22 | ChartType = "bar", 23 | CanvasId = "myFirstBarChart", 24 | Options = new ChartJsOptions() 25 | { 26 | Text = "Sample chart from Blazor", 27 | BorderWidth = 1, 28 | Display = true 29 | }, 30 | Data = new ChartJsBarData() 31 | { 32 | Labels = new List() { "Red", "Blue", "Yellow", "Green", "Purple", "Orange" }, 33 | Datasets = new List() 34 | { 35 | new ChartJsBarDataset() 36 | { 37 | Label = "# of Votes from blazor", 38 | BackgroundColor = new List() {"#cc65fe" }, 39 | BorderColor = "#cc65fe", 40 | PointHoverRadius = 2, 41 | Data = new List(){ 19.187,12.2253,5.5,3,3,2} 42 | }, 43 | new ChartJsBarDataset() 44 | { 45 | Label = "# of Likes from blazor", 46 | BackgroundColor = new List() {"#36a2eb" }, 47 | BorderColor = "#36a2eb", 48 | PointHoverRadius = 2, 49 | Data = new List(){ 30,10,15,13,13,12}.Select(i=> i).ToList() 50 | } 51 | } 52 | } 53 | }; 54 | } 55 | 56 | public async Task UpdateChart() 57 | { 58 | //Update existing dataset 59 | blazorBarChartJS.Data.Labels.Add($"New{DateTime.Now.Second}"); 60 | var firstDataSet = blazorBarChartJS.Data.Datasets[0]; 61 | firstDataSet.Data.Add(DateTime.Now.Second); 62 | StateHasChanged(); 63 | //Add new dataset 64 | //blazorLineChartJS.Data.Datasets.Add(new ChartJsLineDataset() 65 | //{ 66 | // BackgroundColor = "#cc65fe", 67 | // BorderColor = "#cc65fe", 68 | // Label = "# of Votes from blazor 1", 69 | // Data = new List {20,21,12,3,4,4}, 70 | // Fill = true, 71 | // BorderWidth = 2, 72 | // PointRadius = 3, 73 | // PointBorderWidth = 1 74 | //}); 75 | 76 | //var done = await barChartJs.UpdateChart(blazorBarChartJS); 77 | //StateHasChanged(); 78 | 79 | return true; 80 | } 81 | } -------------------------------------------------------------------------------- /samples/TestApplication/Pages/Index.cshtml: -------------------------------------------------------------------------------- 1 | @page "/" 2 | @using BlazorComponents.Shared 3 | 4 |
5 |

Chart JS charts using Blazor

6 |
7 | 8 |
9 | 10 |
11 | 12 | 13 | @functions { 14 | 15 | public ChartJSBarChart blazorBarChartJS { get; set; } = new ChartJSBarChart(); 16 | ChartJsBarChart barChartJs; 17 | 18 | protected override void OnInit() 19 | { 20 | 21 | blazorBarChartJS = new ChartJSBarChart() 22 | { 23 | ChartType = "bar", 24 | CanvasId = "myFirstBarChart", 25 | Options = new ChartJsOptions() 26 | { 27 | Text = "Sample chart from Blazor", 28 | BorderWidth = 1, 29 | Display = true, 30 | // Title of the chart 31 | Title = new ChartJsTitle() 32 | { 33 | Display = true, // Set to false for hiding the title 34 | Text = "Title", 35 | FontSize = 40 36 | }, 37 | Layout = new ChartJsLayout() 38 | { 39 | // add some space to the chart for better rendering 40 | Padding = new ChartJsPadding() 41 | { 42 | Bottom = 0, 43 | Left = 0, 44 | Right = 0, 45 | Top = 50 46 | } 47 | }, 48 | // move the legend 49 | Legend = new ChartJsLegend() 50 | { 51 | Position = "top", 52 | Display = true // set to false for hiding legend 53 | }, 54 | Scales = new ChartJsScale() 55 | { 56 | XAxes = new List() 57 | { 58 | new ChartJsXAxes() 59 | { 60 | Ticks = new ChartJsTicks() 61 | { 62 | BeginAtZero = true, 63 | FontSize = 20 64 | }, 65 | Position = "top" 66 | } 67 | }, 68 | YAxes = new List() 69 | { 70 | new ChartJsYAxes() 71 | { 72 | Ticks = new ChartJsTicks() 73 | { 74 | BeginAtZero = true, 75 | FontSize = 20, 76 | Max = 50 // set a maxmimum value for this axis 77 | } 78 | } 79 | } 80 | }, 81 | Plugins = new ChartJsPlugins() 82 | { 83 | // if you have enabled the plugin you can use these parameters, otherwise it will be ignored 84 | Datalabels = new ChartJsDataLabels() 85 | { 86 | Align = "end", 87 | Anchor = "end", 88 | Color = "black", 89 | Display = true, 90 | Font = new ChartJsDataLabelsFont() 91 | { 92 | Size = 20 93 | } 94 | } 95 | } 96 | }, 97 | Data = new ChartJsBarData() 98 | { 99 | Labels = new List() { "Red", "Blue", "Yellow", "Green", "Purple", "Orange" }, 100 | Datasets = new List() 101 | { 102 | new ChartJsBarDataset() 103 | { 104 | Label = "# of Votes from blazor", 105 | BackgroundColor = new List(){"#cc65fe" }, 106 | BorderColor = "#cc65fe", 107 | PointHoverRadius = 2, 108 | Data = new List(){ 19.187,12.2253,5.5,3,3,2} 109 | }, 110 | new ChartJsBarDataset() 111 | { 112 | Label = "# of Likes from blazor", 113 | BackgroundColor = new List() { 114 | "#a4cef0", 115 | "#3498db", 116 | "#95a5a6", 117 | "#9b59b6", 118 | "#f1c40f", 119 | "#e74c3c", 120 | "#34495e" }, 121 | BorderColor = "#36a2eb", 122 | PointHoverRadius = 2, 123 | Data = new List(){ 30,10,15,13,13,12}.Select(i=> i).ToList() 124 | } 125 | } 126 | } 127 | }; 128 | } 129 | 130 | public async Task UpdateChart() 131 | { 132 | //Update existing dataset 133 | blazorBarChartJS.Data.Labels.Add($"New{DateTime.Now.Second}"); 134 | var firstDataSet = blazorBarChartJS.Data.Datasets[0]; 135 | firstDataSet.Data.Add(DateTime.Now.Second); 136 | //var done = await barChartJs.UpdateChart(); 137 | //Add new dataset 138 | //blazorLineChartJS.Data.Datasets.Add(new ChartJsLineDataset() 139 | //{ 140 | // BackgroundColor = "#cc65fe", 141 | // BorderColor = "#cc65fe", 142 | // Label = "# of Votes from blazor 1", 143 | // Data = new List {20,21,12,3,4,4}, 144 | // Fill = true, 145 | // BorderWidth = 2, 146 | // PointRadius = 3, 147 | // PointBorderWidth = 1 148 | //}); 149 | 150 | //var done = await barChartJs.UpdateChart(blazorBarChartJS); 151 | //StateHasChanged(); 152 | 153 | return true; 154 | } 155 | } -------------------------------------------------------------------------------- /samples/TestApplication/Pages/LineChart.cshtml: -------------------------------------------------------------------------------- 1 | @page "/LineChart" 2 | @using BlazorComponents.Shared 3 | 4 | 5 |

Chart JS charts using Blazor

6 |
7 | 8 |
9 | 10 | 11 | @functions{ 12 | 13 | public ChartJSLineChart blazorLineChartJS { get; set; } = new ChartJSLineChart(); 14 | ChartJsLineChart lineChartJs; 15 | 16 | protected override void OnInit() 17 | { 18 | 19 | blazorLineChartJS = new ChartJSLineChart() 20 | { 21 | ChartType = "line", 22 | CanvasId = "myFirstLineChart", 23 | Options = new ChartJsOptions() 24 | { 25 | Text = "Sample chart from Blazor", 26 | Display = true, 27 | Responsive = false 28 | }, 29 | Data = new ChartJsLineData() 30 | { 31 | Labels = new List() { "Red", "Blue", "Yellow", "Green", "Purple", "Orange" }, 32 | Datasets = new List() 33 | { 34 | new ChartJsLineDataset() 35 | { 36 | BackgroundColor = new List(){"#ff6384" }, 37 | BorderColor = "#ff6384", 38 | Label = "# of Votes from blazor", 39 | Data = new List{ 19,12,5,3,3,2}.Select(i=> i).ToList(), 40 | Fill = false, 41 | BorderWidth = 2, 42 | PointRadius = 3, 43 | PointBorderWidth=1 44 | } 45 | } 46 | } 47 | }; 48 | } 49 | 50 | public void UpdateChart() 51 | { 52 | //Update existing dataset 53 | blazorLineChartJS.Data.Labels.Add($"New{DateTime.Now.Second}"); 54 | var firstDataSet = blazorLineChartJS.Data.Datasets[0]; 55 | firstDataSet.Data.Add(DateTime.Now.Second); 56 | 57 | //Add new dataset 58 | //blazorLineChartJS.Data.Datasets.Add(new ChartJsLineDataset() 59 | //{ 60 | // BackgroundColor = "#cc65fe", 61 | // BorderColor = "#cc65fe", 62 | // Label = "# of Votes from blazor 1", 63 | // Data = new List {20,21,12,3,4,4}, 64 | // Fill = true, 65 | // BorderWidth = 2, 66 | // PointRadius = 3, 67 | // PointBorderWidth = 1 68 | //}); 69 | 70 | lineChartJs.UpdateChart(blazorLineChartJS); 71 | StateHasChanged(); 72 | } 73 | } -------------------------------------------------------------------------------- /samples/TestApplication/Pages/MutipleCharts.cshtml: -------------------------------------------------------------------------------- 1 | @page "/multiple" 2 | @using BlazorComponents.Shared 3 | 4 |
5 |

Chart JS Bar Chart Using Blazor

6 |
7 | 8 |
9 | 10 | 11 |

Chart JS Line Chart Using Blazor

12 |
13 | 14 |
15 | 16 |
17 | 18 | 19 | @functions { 20 | 21 | public ChartJSBarChart blazorBarChartJS { get; set; } = new ChartJSBarChart(); 22 | ChartJsBarChart barChartJs; 23 | public ChartJSLineChart blazorLineChartJS { get; set; } = new ChartJSLineChart(); 24 | ChartJsLineChart lineChartJs; 25 | 26 | protected override void OnInit() 27 | { 28 | 29 | blazorBarChartJS = new ChartJSBarChart() 30 | { 31 | ChartType = "bar", 32 | CanvasId = "myFirstBarChart", 33 | Options = new ChartJsOptions() 34 | { 35 | Text = "Sample chart from Blazor", 36 | BorderWidth = 1, 37 | Display = true 38 | }, 39 | Data = new ChartJsBarData() 40 | { 41 | Labels = new List() { "Red", "Blue", "Yellow", "Green", "Purple", "Orange" }, 42 | Datasets = new List() 43 | { 44 | new ChartJsBarDataset() 45 | { 46 | Label = "# of Votes from blazor", 47 | BackgroundColor = new List(){"#cc65fe" }, 48 | BorderColor = "#cc65fe", 49 | PointHoverRadius = 2, 50 | Data = new List(){ 19.187,12.2253,5.5,3,3,2} 51 | }, 52 | new ChartJsBarDataset() 53 | { 54 | Label = "# of Likes from blazor", 55 | BackgroundColor = new List(){"#36a2eb" }, 56 | BorderColor = "#36a2eb", 57 | PointHoverRadius = 2, 58 | Data = new List(){ 30,10,15,13,13,12}.Select(i=> i).ToList() 59 | } 60 | } 61 | } 62 | }; 63 | 64 | blazorLineChartJS = new ChartJSLineChart() 65 | { 66 | ChartType = "line", 67 | CanvasId = "myFirstLineChart", 68 | Options = new ChartJsOptions() 69 | { 70 | Text = "Sample chart from Blazor", 71 | Display = true, 72 | Responsive = false 73 | }, 74 | Data = new ChartJsLineData() 75 | { 76 | Labels = new List() { "Red", "Blue", "Yellow", "Green", "Purple", "Orange" }, 77 | Datasets = new List() 78 | { 79 | new ChartJsLineDataset() 80 | { 81 | BackgroundColor = new List(){"#ff6384" }, 82 | BorderColor = "#ff6384", 83 | Label = "# of Votes from blazor", 84 | Data = new List{ 19,12,5,3,3,2}.Select(i=> i).ToList(), 85 | Fill = false, 86 | BorderWidth = 2, 87 | PointRadius = 3, 88 | PointBorderWidth=1 89 | } 90 | } 91 | } 92 | }; 93 | } 94 | 95 | public async Task UpdateBarChart() 96 | { 97 | //Update existing dataset 98 | blazorBarChartJS.Data.Labels.Add($"New{DateTime.Now.Second}"); 99 | var firstDataSet = blazorBarChartJS.Data.Datasets[0]; 100 | firstDataSet.Data.Add(DateTime.Now.Second); 101 | 102 | return true; 103 | } 104 | 105 | public void UpdateLineChart() 106 | { 107 | //Update existing dataset 108 | blazorLineChartJS.Data.Labels.Add($"New{DateTime.Now.Second}"); 109 | var firstDataSet = blazorLineChartJS.Data.Datasets[0]; 110 | firstDataSet.Data.Add(DateTime.Now.Second); 111 | } 112 | } -------------------------------------------------------------------------------- /samples/TestApplication/Pages/PieChart.cshtml: -------------------------------------------------------------------------------- 1 | @page "/PieChart" 2 | @using BlazorComponents.Shared 3 | 4 | 5 |

Chart JS charts using Blazor

6 |
7 | 8 |
9 | 10 | 11 | @functions { 12 | 13 | public ChartJSPieChart blazorPieChartJS { get; set; } = new ChartJSPieChart(); 14 | ChartJsPieChart radarChartJs; 15 | 16 | protected override void OnInit() 17 | { 18 | 19 | blazorPieChartJS = new ChartJSPieChart() 20 | { 21 | ChartType = "pie", 22 | CanvasId = "myFirstPieChart", 23 | Options = new ChartJsOptions() 24 | { 25 | Text = "Sample chart from Blazor", 26 | Display = true 27 | }, 28 | Data = new ChartJsPieData() 29 | { 30 | Labels = new List() { "Green", "Blue", "Gray", "Purple", "Yellow", "Red", "Black" }, 31 | Datasets = new List() 32 | { 33 | new ChartJsPieDataset() 34 | { 35 | BackgroundColor = new List { 36 | "#2ecc71", 37 | "#3498db", 38 | "#95a5a6", 39 | "#9b59b6", 40 | "#f1c40f", 41 | "#e74c3c", 42 | "#34495e" 43 | }, 44 | BorderColor = "#ffffff", 45 | Label = "# of Votes from blazor", 46 | Data = new List{ 12, 19, 3, 17, 28, 24, 7}.Select(i=> i).ToList(), 47 | 48 | } 49 | } 50 | } 51 | }; 52 | } 53 | 54 | 55 | public void UpdateChart() 56 | { 57 | //Update existing dataset 58 | blazorPieChartJS.Data.Labels.Add($"New{DateTime.Now.Second}"); 59 | var firstDataSet = blazorPieChartJS.Data.Datasets[0]; 60 | firstDataSet.Data.Add(DateTime.Now.Second); 61 | 62 | //Add new dataset 63 | //blazorPieChartJS.Data.Datasets.Add(new ChartJsPieDataset() 64 | //{ 65 | // BackgroundColor = new List { 66 | // "#2ecc71", 67 | // "#3498db", 68 | // "#95a5a6", 69 | // "#9b59b6", 70 | // "#f1c40f", 71 | // "#e74c3c", 72 | // "#34495e" 73 | // }, 74 | // BorderColor = "#ffffff", 75 | // Label = "# of Votes from blazor", 76 | // Data = new List { 12.5, 19.97, 3.25, 17.75, 28, 24, 7 }, 77 | //}); 78 | 79 | //radarChartJs.UpdateChart(blazorPieChartJS); 80 | } 81 | 82 | } -------------------------------------------------------------------------------- /samples/TestApplication/Pages/RadarChart.cshtml: -------------------------------------------------------------------------------- 1 | @page "/RadarChart" 2 | @using BlazorComponents.Shared 3 | 4 | 5 |

Chart JS charts using Blazor

6 |
7 | 8 |
9 | 10 | 11 | @functions { 12 | 13 | public ChartJSRadarChart blazorRadarChartJS { get; set; } = new ChartJSRadarChart(); 14 | ChartJsRadarChart radarChartJs; 15 | 16 | protected override void OnInit() 17 | { 18 | 19 | blazorRadarChartJS = new ChartJSRadarChart() 20 | { 21 | ChartType = "line", 22 | CanvasId = "myFirstRadarChart", 23 | Options = new ChartJsOptions() 24 | { 25 | Text = "Sample chart from Blazor", 26 | Display = true 27 | }, 28 | Data = new ChartJsRadarData() 29 | { 30 | Labels = new List() { "Eating", "Drinking", "Social", "Coding", "Cycling", "Running" }, 31 | Datasets = new List() 32 | { 33 | new ChartJSRadarDataset() 34 | { 35 | BackgroundColor = new List(){"#ff6384" }, 36 | Label = "1st Dataset", 37 | Data = new List{19.195,12.75,5.25,3,3,2}, 38 | BorderWidth = 2, 39 | RadarChartPointStyle = RadarChartPointStyles.star, 40 | PointBackgroundColor = "#a4cef0", 41 | PointRadius = 5, 42 | PointBorderWidth=1 43 | } 44 | } 45 | } 46 | }; 47 | } 48 | 49 | 50 | public void UpdateChart() 51 | { 52 | //Update existing dataset 53 | blazorRadarChartJS.Data.Labels.Add($"New{DateTime.Now.Second}"); 54 | var firstDataSet = blazorRadarChartJS.Data.Datasets[0]; 55 | firstDataSet.Data.Add(DateTime.Now.Second); 56 | 57 | //Add new dataset 58 | blazorRadarChartJS.Data.Datasets.Add(new ChartJSRadarDataset() 59 | { 60 | BackgroundColor = new List() { "#cc65fe" }, 61 | BorderColor = "#cc65fe", 62 | Label = "2nd Dataset", 63 | Data = new List { 20, 21, 12, 3, 4, 4 }.Select(i => i).ToList(), 64 | BorderWidth = 2, 65 | PointRadius = 3, 66 | PointBorderWidth = 1 67 | }); 68 | 69 | radarChartJs.UpdateChart(blazorRadarChartJS); 70 | } 71 | 72 | } -------------------------------------------------------------------------------- /samples/TestApplication/Pages/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @layout MainLayout 2 | -------------------------------------------------------------------------------- /samples/TestApplication/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Blazor.Hosting; 2 | 3 | namespace TestApplication 4 | { 5 | class Program 6 | { 7 | public static void Main(string[] args) 8 | { 9 | CreateHostBuilder(args).Build().Run(); 10 | } 11 | 12 | public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) => 13 | BlazorWebAssemblyHost.CreateDefaultBuilder() 14 | .UseBlazorStartup(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /samples/TestApplication/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "TestApplication": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development" 8 | }, 9 | "applicationUrl": "http://localhost:54630/" 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /samples/TestApplication/Shared/MainLayout.cshtml: -------------------------------------------------------------------------------- 1 | @inherits BlazorLayoutComponent 2 | 3 | 6 | 7 |
8 |
9 | About 10 |
11 | 12 |
13 | @Body 14 |
15 |
-------------------------------------------------------------------------------- /samples/TestApplication/Shared/NavMenu.cshtml: -------------------------------------------------------------------------------- 1 |  7 | 8 |
9 | 36 |
37 | 38 | @functions { 39 | bool collapseNavMenu = true; 40 | 41 | void ToggleNavMenu() 42 | { 43 | collapseNavMenu = !collapseNavMenu; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /samples/TestApplication/Shared/SurveyPrompt.cshtml: -------------------------------------------------------------------------------- 1 |  11 | 12 | @functions 13 | { 14 | // This is to demonstrate how a parent component can supply parameters 15 | public string Title { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /samples/TestApplication/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Blazor.Builder; 2 | using Microsoft.Extensions.DependencyInjection; 3 | 4 | namespace TestApplication 5 | { 6 | public class Startup 7 | { 8 | public void ConfigureServices(IServiceCollection services) 9 | { 10 | } 11 | 12 | public void Configure(IBlazorApplicationBuilder app) 13 | { 14 | app.AddComponent("app"); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /samples/TestApplication/TestApplication.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | dotnet 6 | blazor serve 7 | 7.3 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | $(IncludeRazorContentInPack) 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /samples/TestApplication/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Blazor 3 | @using Microsoft.AspNetCore.Blazor.Components 4 | @using Microsoft.AspNetCore.Blazor.Layouts 5 | @using Microsoft.AspNetCore.Blazor.Routing 6 | @using TestApplication 7 | @using TestApplication.Shared 8 | @using BlazorComponents.ChartJS 9 | @addTagHelper *,BlazorComponents -------------------------------------------------------------------------------- /samples/TestApplication/wwwroot/css/bootstrap/bootstrap-native.min.js: -------------------------------------------------------------------------------- 1 | // Native Javascript for Bootstrap 3 v2.0.12 | © dnp_theme | MIT-License 2 | !function(t,e){if("function"==typeof define&&define.amd)define([],e);else if("object"==typeof module&&module.exports)module.exports=e();else{var n=e();t.Affix=n.Affix,t.Alert=n.Alert,t.Button=n.Button,t.Carousel=n.Carousel,t.Collapse=n.Collapse,t.Dropdown=n.Dropdown,t.Modal=n.Modal,t.Popover=n.Popover,t.ScrollSpy=n.ScrollSpy,t.Tab=n.Tab,t.Tooltip=n.Tooltip}}(this,function(){var t="undefined"!=typeof global?global:this||window,e=document.documentElement,n=document.body,i="data-toggle",o="data-dismiss",a="data-spy",l="data-ride",r="Affix",c="Alert",u="Button",s="Carousel",f="Collapse",d="Dropdown",h="Modal",p="Popover",m="ScrollSpy",v="Tab",g="Tooltip",b="data-backdrop",x="data-keyboard",T="data-target",y="data-interval",w="data-height",C="data-pause",I="data-original-title",A="data-original-text",L="data-dismissible",E="data-trigger",M="data-animation",k="data-container",S="data-placement",H="data-delay",B="data-offset-top",D="data-offset-bottom",N="backdrop",W="keyboard",P="delay",$="content",j="target",O="interval",q="pause",z="animation",R="placement",U="container",X="offsetTop",Y="offsetBottom",F="offsetLeft",G="scrollTop",J="scrollLeft",K="clientWidth",Q="clientHeight",V="offsetWidth",Z="offsetHeight",_="innerWidth",tt="innerHeight",et="scrollHeight",nt="height",it="aria-expanded",ot="aria-hidden",at="click",lt="hover",rt="keydown",ct="resize",ut="scroll",st="show",ft="shown",dt="hide",ht="hidden",pt="close",mt="closed",vt="slid",gt="slide",bt="change",xt="getAttribute",Tt="setAttribute",yt="hasAttribute",wt="getElementsByTagName",Ct="getBoundingClientRect",It="querySelectorAll",At="getElementsByClassName",Lt="indexOf",Et="parentNode",Mt="length",kt="toLowerCase",St="Transition",Ht="Webkit",Bt="style",Dt="active",Nt="in",Wt="collapsing",Pt="disabled",$t="loading",jt="left",Ot="right",qt="top",zt="bottom",Rt=!("opacity"in n[Bt]),Ut="navbar-fixed-top",Xt="navbar-fixed-bottom",Yt="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],Ft=/\b(top|bottom|left|top)+/,Gt=Ht+St in e[Bt]||St[kt]()in e[Bt],Jt=Ht+St in e[Bt]?Ht[kt]()+St+"End":St[kt]()+"end",Kt=function(t){t.focus?t.focus():t.setActive()},Qt=function(t,e){t.classList.add(e)},Vt=function(t,e){t.classList.remove(e)},Zt=function(t,e){return t.classList.contains(e)},_t=function(t){for(var e=[],n=0,i=t[Mt];n-1||l===r)&&new e(o[a])}},se=/^\#(.)+$/,fe=function(e){var n=e&&(e.currentStyle||t.getComputedStyle(e)),i=/px/.test(n.borderTopWidth)?Math.round(n.borderTopWidth.replace("px","")):0,o=/px/.test(n.borderBottomWidth)?Math.round(n.borderBottomWidth.replace("px","")):0,a=/px/.test(n.marginTop)?Math.round(n.marginTop.replace("px","")):0,l=/px/.test(n.marginBottom)?Math.round(n.marginBottom.replace("px","")):0;return e[Q]+parseInt(i)+parseInt(o)+parseInt(a)+parseInt(l)},de=function(t){for(var e=0,n=0,i=t.children[Mt];n=0&&i[jt]>=0&&i[zt]<=(t[tt]||e[Q])&&i[Ot]<=(t[_]||e[K])},pe=function(){return{y:t.pageYOffset||e[G],x:t.pageXOffset||e[J]}},me=function(t,e,i,o){var a=t[Ct](),l=o===n?pe():{x:o[F]+o[J],y:o[X]+o[G]},r={w:a[Ot]-a[jt],h:a[zt]-a[qt]},c={w:e[V],h:e[Z]};i===qt?(e[Bt][qt]=a[qt]+l.y-c.h+"px",e[Bt][jt]=a[jt]+l.x-c.w/2+r.w/2+"px"):i===zt?(e[Bt][qt]=a[qt]+l.y+r.h+"px",e[Bt][jt]=a[jt]+l.x-c.w/2+r.w/2+"px"):i===jt?(e[Bt][qt]=a[qt]+l.y-c.h/2+r.h/2+"px",e[Bt][jt]=a[jt]+l.x-c.w+"px"):i===Ot&&(e[Bt][qt]=a[qt]+l.y-c.h/2+r.h/2+"px",e[Bt][jt]=a[jt]+l.x+r.w+"px"),e.className[Lt](i)===-1&&(e.className=e.className.replace(Ft,i))},ve=function(t){return t===qt?zt:t===zt?qt:t===jt?Ot:t===Ot?jt:t},ge=function(i,o){i=ee(i),o=o||{};var a=i[xt](T),l=i[xt](B),c=i[xt](D),u="affix",s="affixed",f="function",d="update",h="affix-top",p="affixed-top",m="affix-bottom",v="affixed-bottom";if(this[j]=o[j]?ee(o[j]):ee(a)||null,this[X]=o[X]?o[X]:parseInt(l)||0,this[Y]=o[Y]?o[Y]:parseInt(c)||0,this[j]||this[X]||this[Y]){var g,b,x,y,w,C,I=this,A=Gt?50:500,L=!1,E=!1,M=function(){return Math.max(n[et],n[Z],e[Q],e[et],e[Z])},k=function(){return null!==I[j]?I[j][Ct]()[qt]+y:I[X]?parseInt(typeof I[X]===f?I[X]():I[X]||0):void 0},S=function(){if(I[Y])return x-i[Z]-parseInt(typeof I[Y]===f?I[Y]():I[Y]||0)},H=function(){x=M(),y=parseInt(pe().y,0),g=k(),b=S(),w=parseInt(g)-y<0&&y>parseInt(g),C=parseInt(b)-y<0&&y>parseInt(b)},N=function(){L||Zt(i,u)||(re.call(i,u,u),re.call(i,h,u),Qt(i,u),L=!0,re.call(i,s,u),re.call(i,p,u))},W=function(){L&&Zt(i,u)&&(Vt(i,u),L=!1)},P=function(){E||Zt(i,m)||(re.call(i,u,u),re.call(i,m,u),Qt(i,m),E=!0,re.call(i,s,u),re.call(i,v,u))},$=function(){E&&Zt(i,m)&&(Vt(i,m),E=!1)},O=function(){C?(w&&W(),P()):($(),w?N():W())};this[d]=function(){H(),O()},r in i||(ie(t,ut,this[d]),ie(t,ct,function(){setTimeout(function(){I[d]()},A)})),i[r]=this,this[d]()}};ue(r,ge,a);var be=function(t){t=ee(t);var e=this,n="alert",i=ne(t,"."+n),a=function(){Zt(i,"fade")?le(i,r):r()},l=function(a){var l=a[j];l=l[yt](o)?l:l[Et],l&&l[yt](o)&&(i=ne(l,"."+n),t=ee("["+o+'="'+n+'"]',i),(t===l||t===l[Et])&&i&&e.close())},r=function(){re.call(i,mt,n),oe(t,at,l),i[Et].removeChild(i)};this.close=function(){i&&t&&Zt(i,Nt)&&(re.call(i,pt,n),Vt(i,Nt),i&&a())},c in t||ie(t,at,l),t[c]=this};ue(c,be,o);var xe=function(t,e){t=ee(t),e=e||null;var n=!1,i="button",o="checked",a="reset",l="LABEL",r="INPUT",c=function(){e&&e!==a&&(e===$t&&(Qt(t,Pt),t[Tt](Pt,Pt)),t[Tt](A,t.innerHTML.replace(/^\s+|\s+$/g,"")),t.innerHTML=t[xt]("data-"+e+"-text"))},s=function(){t[xt](A)&&((Zt(t,Pt)||t[xt](Pt)===Pt)&&(Vt(t,Pt),t.removeAttribute(Pt)),t.innerHTML=t[xt](A))},f=function(e){var a=e[j][Et],c=e[j].tagName===l?e[j]:a.tagName===l?a:null;if(c){var u=this,s=te(u,"btn"),f=c[wt](r)[0];if(f){if("checkbox"===f.type&&(f[o]?(Vt(c,Dt),f[xt](o),f.removeAttribute(o),f[o]=!1):(Qt(c,Dt),f[xt](o),f[Tt](o,o),f[o]=!0),n||(n=!0,re.call(f,bt,i),re.call(t,bt,i))),"radio"===f.type&&!n&&!f[o]){Qt(c,Dt),f[Tt](o,o),f[o]=!0,re.call(f,bt,i),re.call(t,bt,i),n=!0;for(var d=0,h=s[Mt];dd||n===v-1&&0===d)&&(g=f[c]=Ot),f.slideTo(d)}},k=function(t){if(t.preventDefault(),!p){var e=t.currentTarget||t.srcElement;e===w?(d++,g=f[c]=jt,d===v-1?d=v-1:d===v&&(d=0)):e===T&&(d--,g=f[c]=Ot,0===d?d=0:d<0&&(d=v-1)),f.slideTo(d)}},S=function(t){if(!p){switch(t.which){case 39:d++,g=f[c]=jt,d==v-1?d=v-1:d==v&&(d=0);break;case 37:d--,g=f[c]=Ot,0==d?d=0:d<0&&(d=v-1);break;default:return}f.slideTo(d)}},H=function(t){for(var e=0,n=A[Mt];e-1&&(n.persist||r))return;c=null,m()}(/\#$/.test(l.href)||l[Et]&&/\#$/.test(l[Et].href))&&e.preventDefault()},p=function(){re.call(a,st,l,c),Qt(a,r),u[Tt](it,!0),re.call(a,ft,l,c),ie(document,rt,f),o=!0},m=function(){re.call(a,dt,l,c),Vt(a,r),u[Tt](it,!1),re.call(a,ht,l,c),oe(document,rt,f),o=!1};this.toggle=function(){Zt(a,r)&&o?m():p()},d in t||(u[Tt]("tabindex","0"),ie(document,at,h)),t[d]=this};ue(d,we,i);var Ce=function(i,a){i=ee(i);var l=i[xt](T)||i[xt]("href"),r=ee(l),c=Zt(i,"modal")?i:r,u="modal",s="static",f="paddingLeft",d="paddingRight",p="modal-backdrop";if(Zt(i,"modal")&&(i=null),c){a=a||{},this[W]=a[W]!==!1&&"false"!==c[xt](x),this[N]=a[N]!==s&&c[xt](b)!==s||s,this[N]=a[N]!==!1&&"false"!==c[xt](b)&&this[N],this[$]=a[$];var m,v,g,y,w=this,C=this.open=!1,I=null,A=te(e,Ut).concat(te(e,Xt)),L=function(){var n=e[Ct]();return t[_]||n[Ot]-Math.abs(n[jt])},E=function(){var e,i=n.currentStyle||t.getComputedStyle(n),o=parseInt(i[d],10);if(m&&(n[Bt][d]=o+g+"px",A[Mt]))for(var a=0;ae[Q],g=k()},H=function(){c[Bt][f]=!m&&v?g+"px":"",c[Bt][d]=m&&!v?g+"px":""},B=function(){c[Bt][f]="",c[Bt][d]=""},D=function(){var t=document.createElement("div");y=ee("."+p),null===y&&(t[Tt]("class",p+" fade"),y=t,n.appendChild(y))},P=function(){y=ee("."+p),y&&null!==y&&"object"==typeof y&&(n.removeChild(y),y=null)},O=function(){Zt(c,Nt)?oe(document,rt,Y):ie(document,rt,Y)},q=function(){Zt(c,Nt)?oe(t,ct,w.update):ie(t,ct,w.update)},z=function(){Zt(c,Nt)?oe(c,at,F):ie(c,at,F)},R=function(){C=w.open=!0,Kt(c),re.call(c,ft,u,I)},U=function(){q(),z(),O(),c[Bt].display="",C=w.open=!1,i&&Kt(i),re.call(c,ht,u),setTimeout(function(){te(document,u+" "+Nt)[0]||(B(),M(),Vt(n,u+"-open"),P())},100)},X=function(t){var e=t[j];e=e[yt](T)||e[yt]("href")?e:e[Et],C||e!==i||Zt(c,Nt)||(c.modalTrigger=i,I=i,w.show(),t.preventDefault())},Y=function(t){var e=t.which||t.keyCode;w[W]&&27==e&&C&&w.hide()},F=function(t){var e=t[j];C&&(e[Et][xt](o)===u||e[xt](o)===u||e===c&&w[N]!==s)&&(w.hide(),I=null,t.preventDefault())};this.toggle=function(){C&&Zt(c,Nt)?this.hide():this.show()},this.show=function(){re.call(c,st,u,I);var t=te(document,u+" in")[0];t&&t!==c&&t.modalTrigger[h].hide(),this[N]&&D(),y&&!Zt(y,Nt)&&setTimeout(function(){Qt(y,Nt)},0),setTimeout(function(){c[Bt].display="block",S(),E(),H(),q(),z(),O(),Qt(n,u+"-open"),Qt(c,Nt),c[Tt](ot,!1),Zt(c,"fade")?le(c,R):R()},Gt?150:0)},this.hide=function(){re.call(c,dt,u),y=ee("."+p),Vt(c,Nt),c[Tt](ot,!0),!!y&&Vt(y,Nt),setTimeout(function(){Zt(c,"fade")?le(c,U):U()},Gt?150:0)},this.setContent=function(t){ee("."+u+"-content",c).innerHTML=t},this.update=function(){C&&(S(),E(),H())},!i||h in i||ie(i,at,X),this[$]&&this.setContent(this[$]),!!i&&(i[h]=this)}};ue(h,Ce,i);var Ie=function(e,i){e=ee(e);var o=e[xt](E),a=e[xt](M),l=e[xt](S),r=e[xt](L),c=e[xt](H),u=e[xt](k),s="popover",f="template",d="trigger",h="class",m="div",v="fade",g="data-title",b="data-content",x="dismissible",T='',y=ne(e,".modal"),w=ne(e,"."+Ut),C=ne(e,"."+Xt);i=i||{},this[f]=i[f]?i[f]:null,this[d]=i[d]?i[d]:o||lt,this[z]=i[z]&&i[z]!==v?i[z]:a||v,this[R]=i[R]?i[R]:l||qt,this[P]=parseInt(i[P]||c)||200,this[x]=!(!i[x]&&"true"!==r),this[U]=ee(i[U])?ee(i[U]):ee(u)?ee(u):w?w:C?C:y?y:n;var I=this,A=e[xt](g)||null,B=e[xt](b)||null;if(B||this[f]){var D=null,N=0,W=this[R],$=function(t){null!==D&&t[j]===ee(".close",D)&&I.hide()},O=function(){I[U].removeChild(D),N=null,D=null},q=function(){if(A=e[xt](g),B=e[xt](b),D=document.createElement(m),null!==B&&null===I[f]){if(D[Tt]("role","tooltip"),null!==A){var t=document.createElement("h3");t[Tt](h,s+"-title"),t.innerHTML=I[x]?A+T:A,D.appendChild(t)}var n=document.createElement(m),i=document.createElement(m);n[Tt](h,"arrow"),i[Tt](h,s+"-content"),D.appendChild(n),D.appendChild(i),i.innerHTML=I[x]&&null===A?B+T:B}else{var o=document.createElement(m);o.innerHTML=I[f],D.innerHTML=o.firstChild.innerHTML}I[U].appendChild(D),D[Bt].display="block",D[Tt](h,s+" "+W+" "+I[z])},X=function(){!Zt(D,Nt)&&Qt(D,Nt)},Y=function(){me(e,D,W,I[U]),he(D)||(W=ve(W),me(e,D,W,I[U]))},F=function(){re.call(e,ft,s)},G=function(){O(),re.call(e,ht,s)};this.toggle=function(){null===D?I.show():I.hide()},this.show=function(){clearTimeout(N),N=setTimeout(function(){null===D&&(W=I[R],q(),Y(),X(),re.call(e,st,s),I[z]?le(D,F):F())},20)},this.hide=function(){clearTimeout(N),N=setTimeout(function(){D&&null!==D&&Zt(D,Nt)&&(re.call(e,dt,s),Vt(D,Nt),I[z]?le(D,G):G())},I[P])},p in e||(I[d]===lt?(ie(e,Yt[0],I.show),I[x]||ie(e,Yt[1],I.hide)):/^(click|focus)$/.test(I[d])&&(ie(e,I[d],I.toggle),I[x]||ie(e,"blur",I.hide)),I[x]&&ie(document,at,$),!Rt&&ie(t,ct,I.hide)),e[p]=I}};ue(p,Ie,i);var Ae=function(e,n){e=ee(e);var i=ee(e[xt](T));if(n=n||{},n[j]||i){for(var o,a=n[j]&&ee(n[j])||i,l=a&&a[wt]("A"),r=[],c=[],u=e[Z]=f&&d>o;if(!u&&h)"LI"!==n.tagName||Zt(n,Dt)||(Qt(n,Dt),u=!0,a&&!Zt(a,Dt)&&Qt(a,Dt),re.call(e,"activate","scrollspy",r[t]));else if(h){if(!h&&!u||u&&h)return}else"LI"===n.tagName&&Zt(n,Dt)&&(Vt(n,Dt),u=!1,a&&Zt(a,Dt)&&!te(n[Et],Dt).length&&Vt(a,Dt))},g=function(){o=s?pe().y:e[G];for(var t=0,n=r[Mt];t1&&(t=e[e[Mt]-1]):t=e[0],t[wt]("A")[0]},x=function(){return ee(b()[xt]("href"))},T=function(t){t.preventDefault(),r=t[j][xt](i)===o||se.test(t[j][xt]("href"))?t[j]:t[j][Et],d.show()};this.show=function(){r=r||t,f=ee(r[xt]("href")),u=b(),s=x(),u[l]&&r[l]||Zt(r[Et],Dt)||(u[l]=r[l]=!0,Vt(u[Et],Dt),Qt(r[Et],Dt),p&&(Zt(t[Et][Et],"dropdown-menu")?Zt(p,Dt)||Qt(p,Dt):Zt(p,Dt)&&Vt(p,Dt)),c&&(c[Bt][a]=de(s)+"px"),function(){Vt(s,Nt),re.call(u,dt,o,r),function(){Zt(s,"fade")?le(s,g):g()}()}(),function(){Zt(f,"fade")?le(f,m):m()}())},v in t||ie(t,at,T),this[a]&&(c=x()[Et]),t[v]=this}};ue(v,Le,i);var Ee=function(t,e){t=ee(t);var i=t[xt](M),o=t[xt](S),a=t[xt](H),l=t[xt](k),r="tooltip",c="class",u="title",s="fade",f="div",d=ne(t,".modal"),h=ne(t,"."+Ut),p=ne(t,"."+Xt);e=e||{},this[z]=e[z]&&e[z]!==s?e[z]:i||s,this[R]=e[R]?e[R]:o||qt,this[P]=parseInt(e[P]||a)||200,this[U]=ee(e[U])?ee(e[U]):ee(l)?ee(l):h?h:p?p:d?d:n;var m=this,v=0,b=this[R],x=null,T=t[xt](u)||t[xt](I);if(T){var y=function(){m[U].removeChild(x),x=null,v=null},w=function(){T=t[xt](u)||t[xt](I),x=document.createElement(f),x[Tt]("role",r);var e=document.createElement(f),n=document.createElement(f);e[Tt](c,r+"-arrow"),n[Tt](c,r+"-inner"),x.appendChild(e),x.appendChild(n),n.innerHTML=T,m[U].appendChild(x),x[Tt](c,r+" "+b+" "+m[z])},C=function(){me(t,x,b,m[U]),he(x)||(b=ve(b),me(t,x,b,m[U]))},A=function(){!Zt(x,Nt)&&Qt(x,Nt)},L=function(){re.call(t,ft,r)},E=function(){y(),re.call(t,ht,r)};this.show=function(){clearTimeout(v),v=setTimeout(function(){null===x&&(b=m[R],w(),C(),A(),re.call(t,st,r),m[z]?le(x,L):L())},20)},this.hide=function(){clearTimeout(v),v=setTimeout(function(){x&&null!==x&&Zt(x,Nt)&&(re.call(t,dt,r),Vt(x,Nt),m[z]?le(x,E):E())},m[P])},this.toggle=function(){x?m.hide():m.show()},g in t||(t[Tt](I,T),t.removeAttribute(u),ie(t,Yt[0],this.show),ie(t,Yt[1],this.hide)),t[g]=this}};return ue(g,Ee,i),{Affix:ge,Alert:be,Button:xe,Carousel:Te,Collapse:ye,Dropdown:we,Modal:Ce,Popover:Ie,ScrollSpy:Ae,Tab:Le,Tooltip:Ee}}); 3 | -------------------------------------------------------------------------------- /samples/TestApplication/wwwroot/css/open-iconic/FONT-LICENSE: -------------------------------------------------------------------------------- 1 | SIL OPEN FONT LICENSE Version 1.1 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | PREAMBLE 6 | The goals of the Open Font License (OFL) are to stimulate worldwide 7 | development of collaborative font projects, to support the font creation 8 | efforts of academic and linguistic communities, and to provide a free and 9 | open framework in which fonts may be shared and improved in partnership 10 | with others. 11 | 12 | The OFL allows the licensed fonts to be used, studied, modified and 13 | redistributed freely as long as they are not sold by themselves. The 14 | fonts, including any derivative works, can be bundled, embedded, 15 | redistributed and/or sold with any software provided that any reserved 16 | names are not used by derivative works. The fonts and derivatives, 17 | however, cannot be released under any other type of license. The 18 | requirement for fonts to remain under this license does not apply 19 | to any document created using the fonts or their derivatives. 20 | 21 | DEFINITIONS 22 | "Font Software" refers to the set of files released by the Copyright 23 | Holder(s) under this license and clearly marked as such. This may 24 | include source files, build scripts and documentation. 25 | 26 | "Reserved Font Name" refers to any names specified as such after the 27 | copyright statement(s). 28 | 29 | "Original Version" refers to the collection of Font Software components as 30 | distributed by the Copyright Holder(s). 31 | 32 | "Modified Version" refers to any derivative made by adding to, deleting, 33 | or substituting -- in part or in whole -- any of the components of the 34 | Original Version, by changing formats or by porting the Font Software to a 35 | new environment. 36 | 37 | "Author" refers to any designer, engineer, programmer, technical 38 | writer or other person who contributed to the Font Software. 39 | 40 | PERMISSION & CONDITIONS 41 | Permission is hereby granted, free of charge, to any person obtaining 42 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 43 | redistribute, and sell modified and unmodified copies of the Font 44 | Software, subject to the following conditions: 45 | 46 | 1) Neither the Font Software nor any of its individual components, 47 | in Original or Modified Versions, may be sold by itself. 48 | 49 | 2) Original or Modified Versions of the Font Software may be bundled, 50 | redistributed and/or sold with any software, provided that each copy 51 | contains the above copyright notice and this license. These can be 52 | included either as stand-alone text files, human-readable headers or 53 | in the appropriate machine-readable metadata fields within text or 54 | binary files as long as those fields can be easily viewed by the user. 55 | 56 | 3) No Modified Version of the Font Software may use the Reserved Font 57 | Name(s) unless explicit written permission is granted by the corresponding 58 | Copyright Holder. This restriction only applies to the primary font name as 59 | presented to the users. 60 | 61 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 62 | Software shall not be used to promote, endorse or advertise any 63 | Modified Version, except to acknowledge the contribution(s) of the 64 | Copyright Holder(s) and the Author(s) or with their explicit written 65 | permission. 66 | 67 | 5) The Font Software, modified or unmodified, in part or in whole, 68 | must be distributed entirely under this license, and must not be 69 | distributed under any other license. The requirement for fonts to 70 | remain under this license does not apply to any document created 71 | using the Font Software. 72 | 73 | TERMINATION 74 | This license becomes null and void if any of the above conditions are 75 | not met. 76 | 77 | DISCLAIMER 78 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 79 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 80 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 81 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 82 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 83 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 84 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 85 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 86 | OTHER DEALINGS IN THE FONT SOFTWARE. 87 | -------------------------------------------------------------------------------- /samples/TestApplication/wwwroot/css/open-iconic/ICON-LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Waybury 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /samples/TestApplication/wwwroot/css/open-iconic/README.md: -------------------------------------------------------------------------------- 1 | [Open Iconic v1.1.1](http://useiconic.com/open) 2 | =========== 3 | 4 | ### Open Iconic is the open source sibling of [Iconic](http://useiconic.com). It is a hyper-legible collection of 223 icons with a tiny footprint—ready to use with Bootstrap and Foundation. [View the collection](http://useiconic.com/open#icons) 5 | 6 | 7 | 8 | ## What's in Open Iconic? 9 | 10 | * 223 icons designed to be legible down to 8 pixels 11 | * Super-light SVG files - 61.8 for the entire set 12 | * SVG sprite—the modern replacement for icon fonts 13 | * Webfont (EOT, OTF, SVG, TTF, WOFF), PNG and WebP formats 14 | * Webfont stylesheets (including versions for Bootstrap and Foundation) in CSS, LESS, SCSS and Stylus formats 15 | * PNG and WebP raster images in 8px, 16px, 24px, 32px, 48px and 64px. 16 | 17 | 18 | ## Getting Started 19 | 20 | #### For code samples and everything else you need to get started with Open Iconic, check out our [Icons](http://useiconic.com/open#icons) and [Reference](http://useiconic.com/open#reference) sections. 21 | 22 | ### General Usage 23 | 24 | #### Using Open Iconic's SVGs 25 | 26 | We like SVGs and we think they're the way to display icons on the web. Since Open Iconic are just basic SVGs, we suggest you display them like you would any other image (don't forget the `alt` attribute). 27 | 28 | ``` 29 | icon name 30 | ``` 31 | 32 | #### Using Open Iconic's SVG Sprite 33 | 34 | Open Iconic also comes in a SVG sprite which allows you to display all the icons in the set with a single request. It's like an icon font, without being a hack. 35 | 36 | Adding an icon from an SVG sprite is a little different than what you're used to, but it's still a piece of cake. *Tip: To make your icons easily style able, we suggest adding a general class to the* `` *tag and a unique class name for each different icon in the* `` *tag.* 37 | 38 | ``` 39 | 40 | 41 | 42 | ``` 43 | 44 | Sizing icons only needs basic CSS. All the icons are in a square format, so just set the `` tag with equal width and height dimensions. 45 | 46 | ``` 47 | .icon { 48 | width: 16px; 49 | height: 16px; 50 | } 51 | ``` 52 | 53 | Coloring icons is even easier. All you need to do is set the `fill` rule on the `` tag. 54 | 55 | ``` 56 | .icon-account-login { 57 | fill: #f00; 58 | } 59 | ``` 60 | 61 | To learn more about SVG Sprites, read [Chris Coyier's guide](http://css-tricks.com/svg-sprites-use-better-icon-fonts/). 62 | 63 | #### Using Open Iconic's Icon Font... 64 | 65 | 66 | ##### …with Bootstrap 67 | 68 | You can find our Bootstrap stylesheets in `font/css/open-iconic-bootstrap.{css, less, scss, styl}` 69 | 70 | 71 | ``` 72 | 73 | ``` 74 | 75 | 76 | ``` 77 | 78 | ``` 79 | 80 | ##### …with Foundation 81 | 82 | You can find our Foundation stylesheets in `font/css/open-iconic-foundation.{css, less, scss, styl}` 83 | 84 | ``` 85 | 86 | ``` 87 | 88 | 89 | ``` 90 | 91 | ``` 92 | 93 | ##### …on its own 94 | 95 | You can find our default stylesheets in `font/css/open-iconic.{css, less, scss, styl}` 96 | 97 | ``` 98 | 99 | ``` 100 | 101 | ``` 102 | 103 | ``` 104 | 105 | 106 | ## License 107 | 108 | ### Icons 109 | 110 | All code (including SVG markup) is under the [MIT License](http://opensource.org/licenses/MIT). 111 | 112 | ### Fonts 113 | 114 | All fonts are under the [SIL Licensed](http://scripts.sil.org/cms/scripts/page.php?item_id=OFL_web). 115 | -------------------------------------------------------------------------------- /samples/TestApplication/wwwroot/css/open-iconic/font/css/open-iconic-bootstrap.min.css: -------------------------------------------------------------------------------- 1 | @font-face{font-family:Icons;src:url(../fonts/open-iconic.eot);src:url(../fonts/open-iconic.eot?#iconic-sm) format('embedded-opentype'),url(../fonts/open-iconic.woff) format('woff'),url(../fonts/open-iconic.ttf) format('truetype'),url(../fonts/open-iconic.otf) format('opentype'),url(../fonts/open-iconic.svg#iconic-sm) format('svg');font-weight:400;font-style:normal}.oi{position:relative;top:1px;display:inline-block;speak:none;font-family:Icons;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.oi:empty:before{width:1em;text-align:center;box-sizing:content-box}.oi.oi-align-center:before{text-align:center}.oi.oi-align-left:before{text-align:left}.oi.oi-align-right:before{text-align:right}.oi.oi-flip-horizontal:before{-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.oi.oi-flip-vertical:before{-webkit-transform:scale(1,-1);-ms-transform:scale(-1,1);transform:scale(1,-1)}.oi.oi-flip-horizontal-vertical:before{-webkit-transform:scale(-1,-1);-ms-transform:scale(-1,1);transform:scale(-1,-1)}.oi-account-login:before{content:'\e000'}.oi-account-logout:before{content:'\e001'}.oi-action-redo:before{content:'\e002'}.oi-action-undo:before{content:'\e003'}.oi-align-center:before{content:'\e004'}.oi-align-left:before{content:'\e005'}.oi-align-right:before{content:'\e006'}.oi-aperture:before{content:'\e007'}.oi-arrow-bottom:before{content:'\e008'}.oi-arrow-circle-bottom:before{content:'\e009'}.oi-arrow-circle-left:before{content:'\e00a'}.oi-arrow-circle-right:before{content:'\e00b'}.oi-arrow-circle-top:before{content:'\e00c'}.oi-arrow-left:before{content:'\e00d'}.oi-arrow-right:before{content:'\e00e'}.oi-arrow-thick-bottom:before{content:'\e00f'}.oi-arrow-thick-left:before{content:'\e010'}.oi-arrow-thick-right:before{content:'\e011'}.oi-arrow-thick-top:before{content:'\e012'}.oi-arrow-top:before{content:'\e013'}.oi-audio-spectrum:before{content:'\e014'}.oi-audio:before{content:'\e015'}.oi-badge:before{content:'\e016'}.oi-ban:before{content:'\e017'}.oi-bar-chart:before{content:'\e018'}.oi-basket:before{content:'\e019'}.oi-battery-empty:before{content:'\e01a'}.oi-battery-full:before{content:'\e01b'}.oi-beaker:before{content:'\e01c'}.oi-bell:before{content:'\e01d'}.oi-bluetooth:before{content:'\e01e'}.oi-bold:before{content:'\e01f'}.oi-bolt:before{content:'\e020'}.oi-book:before{content:'\e021'}.oi-bookmark:before{content:'\e022'}.oi-box:before{content:'\e023'}.oi-briefcase:before{content:'\e024'}.oi-british-pound:before{content:'\e025'}.oi-browser:before{content:'\e026'}.oi-brush:before{content:'\e027'}.oi-bug:before{content:'\e028'}.oi-bullhorn:before{content:'\e029'}.oi-calculator:before{content:'\e02a'}.oi-calendar:before{content:'\e02b'}.oi-camera-slr:before{content:'\e02c'}.oi-caret-bottom:before{content:'\e02d'}.oi-caret-left:before{content:'\e02e'}.oi-caret-right:before{content:'\e02f'}.oi-caret-top:before{content:'\e030'}.oi-cart:before{content:'\e031'}.oi-chat:before{content:'\e032'}.oi-check:before{content:'\e033'}.oi-chevron-bottom:before{content:'\e034'}.oi-chevron-left:before{content:'\e035'}.oi-chevron-right:before{content:'\e036'}.oi-chevron-top:before{content:'\e037'}.oi-circle-check:before{content:'\e038'}.oi-circle-x:before{content:'\e039'}.oi-clipboard:before{content:'\e03a'}.oi-clock:before{content:'\e03b'}.oi-cloud-download:before{content:'\e03c'}.oi-cloud-upload:before{content:'\e03d'}.oi-cloud:before{content:'\e03e'}.oi-cloudy:before{content:'\e03f'}.oi-code:before{content:'\e040'}.oi-cog:before{content:'\e041'}.oi-collapse-down:before{content:'\e042'}.oi-collapse-left:before{content:'\e043'}.oi-collapse-right:before{content:'\e044'}.oi-collapse-up:before{content:'\e045'}.oi-command:before{content:'\e046'}.oi-comment-square:before{content:'\e047'}.oi-compass:before{content:'\e048'}.oi-contrast:before{content:'\e049'}.oi-copywriting:before{content:'\e04a'}.oi-credit-card:before{content:'\e04b'}.oi-crop:before{content:'\e04c'}.oi-dashboard:before{content:'\e04d'}.oi-data-transfer-download:before{content:'\e04e'}.oi-data-transfer-upload:before{content:'\e04f'}.oi-delete:before{content:'\e050'}.oi-dial:before{content:'\e051'}.oi-document:before{content:'\e052'}.oi-dollar:before{content:'\e053'}.oi-double-quote-sans-left:before{content:'\e054'}.oi-double-quote-sans-right:before{content:'\e055'}.oi-double-quote-serif-left:before{content:'\e056'}.oi-double-quote-serif-right:before{content:'\e057'}.oi-droplet:before{content:'\e058'}.oi-eject:before{content:'\e059'}.oi-elevator:before{content:'\e05a'}.oi-ellipses:before{content:'\e05b'}.oi-envelope-closed:before{content:'\e05c'}.oi-envelope-open:before{content:'\e05d'}.oi-euro:before{content:'\e05e'}.oi-excerpt:before{content:'\e05f'}.oi-expand-down:before{content:'\e060'}.oi-expand-left:before{content:'\e061'}.oi-expand-right:before{content:'\e062'}.oi-expand-up:before{content:'\e063'}.oi-external-link:before{content:'\e064'}.oi-eye:before{content:'\e065'}.oi-eyedropper:before{content:'\e066'}.oi-file:before{content:'\e067'}.oi-fire:before{content:'\e068'}.oi-flag:before{content:'\e069'}.oi-flash:before{content:'\e06a'}.oi-folder:before{content:'\e06b'}.oi-fork:before{content:'\e06c'}.oi-fullscreen-enter:before{content:'\e06d'}.oi-fullscreen-exit:before{content:'\e06e'}.oi-globe:before{content:'\e06f'}.oi-graph:before{content:'\e070'}.oi-grid-four-up:before{content:'\e071'}.oi-grid-three-up:before{content:'\e072'}.oi-grid-two-up:before{content:'\e073'}.oi-hard-drive:before{content:'\e074'}.oi-header:before{content:'\e075'}.oi-headphones:before{content:'\e076'}.oi-heart:before{content:'\e077'}.oi-home:before{content:'\e078'}.oi-image:before{content:'\e079'}.oi-inbox:before{content:'\e07a'}.oi-infinity:before{content:'\e07b'}.oi-info:before{content:'\e07c'}.oi-italic:before{content:'\e07d'}.oi-justify-center:before{content:'\e07e'}.oi-justify-left:before{content:'\e07f'}.oi-justify-right:before{content:'\e080'}.oi-key:before{content:'\e081'}.oi-laptop:before{content:'\e082'}.oi-layers:before{content:'\e083'}.oi-lightbulb:before{content:'\e084'}.oi-link-broken:before{content:'\e085'}.oi-link-intact:before{content:'\e086'}.oi-list-rich:before{content:'\e087'}.oi-list:before{content:'\e088'}.oi-location:before{content:'\e089'}.oi-lock-locked:before{content:'\e08a'}.oi-lock-unlocked:before{content:'\e08b'}.oi-loop-circular:before{content:'\e08c'}.oi-loop-square:before{content:'\e08d'}.oi-loop:before{content:'\e08e'}.oi-magnifying-glass:before{content:'\e08f'}.oi-map-marker:before{content:'\e090'}.oi-map:before{content:'\e091'}.oi-media-pause:before{content:'\e092'}.oi-media-play:before{content:'\e093'}.oi-media-record:before{content:'\e094'}.oi-media-skip-backward:before{content:'\e095'}.oi-media-skip-forward:before{content:'\e096'}.oi-media-step-backward:before{content:'\e097'}.oi-media-step-forward:before{content:'\e098'}.oi-media-stop:before{content:'\e099'}.oi-medical-cross:before{content:'\e09a'}.oi-menu:before{content:'\e09b'}.oi-microphone:before{content:'\e09c'}.oi-minus:before{content:'\e09d'}.oi-monitor:before{content:'\e09e'}.oi-moon:before{content:'\e09f'}.oi-move:before{content:'\e0a0'}.oi-musical-note:before{content:'\e0a1'}.oi-paperclip:before{content:'\e0a2'}.oi-pencil:before{content:'\e0a3'}.oi-people:before{content:'\e0a4'}.oi-person:before{content:'\e0a5'}.oi-phone:before{content:'\e0a6'}.oi-pie-chart:before{content:'\e0a7'}.oi-pin:before{content:'\e0a8'}.oi-play-circle:before{content:'\e0a9'}.oi-plus:before{content:'\e0aa'}.oi-power-standby:before{content:'\e0ab'}.oi-print:before{content:'\e0ac'}.oi-project:before{content:'\e0ad'}.oi-pulse:before{content:'\e0ae'}.oi-puzzle-piece:before{content:'\e0af'}.oi-question-mark:before{content:'\e0b0'}.oi-rain:before{content:'\e0b1'}.oi-random:before{content:'\e0b2'}.oi-reload:before{content:'\e0b3'}.oi-resize-both:before{content:'\e0b4'}.oi-resize-height:before{content:'\e0b5'}.oi-resize-width:before{content:'\e0b6'}.oi-rss-alt:before{content:'\e0b7'}.oi-rss:before{content:'\e0b8'}.oi-script:before{content:'\e0b9'}.oi-share-boxed:before{content:'\e0ba'}.oi-share:before{content:'\e0bb'}.oi-shield:before{content:'\e0bc'}.oi-signal:before{content:'\e0bd'}.oi-signpost:before{content:'\e0be'}.oi-sort-ascending:before{content:'\e0bf'}.oi-sort-descending:before{content:'\e0c0'}.oi-spreadsheet:before{content:'\e0c1'}.oi-star:before{content:'\e0c2'}.oi-sun:before{content:'\e0c3'}.oi-tablet:before{content:'\e0c4'}.oi-tag:before{content:'\e0c5'}.oi-tags:before{content:'\e0c6'}.oi-target:before{content:'\e0c7'}.oi-task:before{content:'\e0c8'}.oi-terminal:before{content:'\e0c9'}.oi-text:before{content:'\e0ca'}.oi-thumb-down:before{content:'\e0cb'}.oi-thumb-up:before{content:'\e0cc'}.oi-timer:before{content:'\e0cd'}.oi-transfer:before{content:'\e0ce'}.oi-trash:before{content:'\e0cf'}.oi-underline:before{content:'\e0d0'}.oi-vertical-align-bottom:before{content:'\e0d1'}.oi-vertical-align-center:before{content:'\e0d2'}.oi-vertical-align-top:before{content:'\e0d3'}.oi-video:before{content:'\e0d4'}.oi-volume-high:before{content:'\e0d5'}.oi-volume-low:before{content:'\e0d6'}.oi-volume-off:before{content:'\e0d7'}.oi-warning:before{content:'\e0d8'}.oi-wifi:before{content:'\e0d9'}.oi-wrench:before{content:'\e0da'}.oi-x:before{content:'\e0db'}.oi-yen:before{content:'\e0dc'}.oi-zoom-in:before{content:'\e0dd'}.oi-zoom-out:before{content:'\e0de'} -------------------------------------------------------------------------------- /samples/TestApplication/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/muqeet-khan/BlazorComponents/5244263139306eed6329c80ae6c0a4baa931d958/samples/TestApplication/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /samples/TestApplication/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/muqeet-khan/BlazorComponents/5244263139306eed6329c80ae6c0a4baa931d958/samples/TestApplication/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /samples/TestApplication/wwwroot/css/open-iconic/font/fonts/open-iconic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | Created by FontForge 20120731 at Tue Jul 1 20:39:22 2014 9 | By P.J. Onori 10 | Created by P.J. Onori with FontForge 2.0 (http://fontforge.sf.net) 11 | 12 | 13 | 14 | 27 | 28 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 45 | 47 | 49 | 51 | 53 | 55 | 57 | 59 | 61 | 63 | 65 | 67 | 69 | 71 | 74 | 76 | 79 | 81 | 84 | 86 | 88 | 91 | 93 | 95 | 98 | 100 | 102 | 104 | 106 | 109 | 112 | 115 | 117 | 121 | 123 | 125 | 127 | 130 | 132 | 134 | 136 | 138 | 141 | 143 | 145 | 147 | 149 | 151 | 153 | 155 | 157 | 159 | 162 | 165 | 167 | 169 | 172 | 174 | 177 | 179 | 181 | 183 | 185 | 189 | 191 | 194 | 196 | 198 | 200 | 202 | 205 | 207 | 209 | 211 | 213 | 215 | 218 | 220 | 222 | 224 | 226 | 228 | 230 | 232 | 234 | 236 | 238 | 241 | 243 | 245 | 247 | 249 | 251 | 253 | 256 | 259 | 261 | 263 | 265 | 267 | 269 | 272 | 274 | 276 | 280 | 282 | 285 | 287 | 289 | 292 | 295 | 298 | 300 | 302 | 304 | 306 | 309 | 312 | 314 | 316 | 318 | 320 | 322 | 324 | 326 | 330 | 334 | 338 | 340 | 343 | 345 | 347 | 349 | 351 | 353 | 355 | 358 | 360 | 363 | 365 | 367 | 369 | 371 | 373 | 375 | 377 | 379 | 381 | 383 | 386 | 388 | 390 | 392 | 394 | 396 | 399 | 401 | 404 | 406 | 408 | 410 | 412 | 414 | 416 | 419 | 421 | 423 | 425 | 428 | 431 | 435 | 438 | 440 | 442 | 444 | 446 | 448 | 451 | 453 | 455 | 457 | 460 | 462 | 464 | 466 | 468 | 471 | 473 | 477 | 479 | 481 | 483 | 486 | 488 | 490 | 492 | 494 | 496 | 499 | 501 | 504 | 506 | 509 | 512 | 515 | 517 | 520 | 522 | 524 | 526 | 529 | 532 | 534 | 536 | 539 | 542 | 543 | 544 | -------------------------------------------------------------------------------- /samples/TestApplication/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/muqeet-khan/BlazorComponents/5244263139306eed6329c80ae6c0a4baa931d958/samples/TestApplication/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /samples/TestApplication/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/muqeet-khan/BlazorComponents/5244263139306eed6329c80ae6c0a4baa931d958/samples/TestApplication/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /samples/TestApplication/wwwroot/css/site.css: -------------------------------------------------------------------------------- 1 | @import url('open-iconic/font/css/open-iconic-bootstrap.min.css'); 2 | 3 | html, body { 4 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 5 | } 6 | 7 | app { 8 | position: relative; 9 | display: flex; 10 | flex-direction: column; 11 | } 12 | 13 | .top-row { 14 | height: 3.5rem; 15 | display: flex; 16 | align-items: center; 17 | } 18 | 19 | .main { 20 | flex: 1; 21 | } 22 | 23 | .main .top-row { 24 | background-color: #e6e6e6; 25 | border-bottom: 1px solid #d6d5d5; 26 | } 27 | 28 | .sidebar { 29 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); 30 | } 31 | 32 | .sidebar .top-row { 33 | background-color: rgba(0,0,0,0.4); 34 | } 35 | 36 | .sidebar .navbar-brand { 37 | font-size: 1.1rem; 38 | } 39 | 40 | .sidebar .oi { 41 | width: 2rem; 42 | font-size: 1.1rem; 43 | vertical-align: text-top; 44 | top: -2px; 45 | } 46 | 47 | .nav-item { 48 | font-size: 0.9rem; 49 | padding-bottom: 0.5rem; 50 | } 51 | 52 | .nav-item:first-of-type { 53 | padding-top: 1rem; 54 | } 55 | 56 | .nav-item:last-of-type { 57 | padding-bottom: 1rem; 58 | } 59 | 60 | .nav-item a { 61 | color: #d7d7d7; 62 | border-radius: 4px; 63 | height: 3rem; 64 | display: flex; 65 | align-items: center; 66 | line-height: 3rem; 67 | } 68 | 69 | .nav-item a.active { 70 | background-color: rgba(255,255,255,0.25); 71 | color: white; 72 | } 73 | 74 | .nav-item a:hover { 75 | background-color: rgba(255,255,255,0.1); 76 | color: white; 77 | } 78 | 79 | .content { 80 | padding-top: 1.1rem; 81 | } 82 | 83 | .navbar-toggler { 84 | background-color: rgba(255, 255, 255, 0.1); 85 | } 86 | 87 | @media (max-width: 767.98px) { 88 | .main .top-row { 89 | display: none; 90 | } 91 | } 92 | 93 | @media (min-width: 768px) { 94 | app { 95 | flex-direction: row; 96 | } 97 | 98 | .sidebar { 99 | width: 250px; 100 | height: 100vh; 101 | position: sticky; 102 | top: 0; 103 | } 104 | 105 | .main .top-row { 106 | position: sticky; 107 | top: 0; 108 | } 109 | 110 | .main > div { 111 | padding-left: 2rem !important; 112 | padding-right: 1.5rem !important; 113 | } 114 | 115 | .navbar-toggler { 116 | display: none; 117 | } 118 | 119 | .sidebar .collapse { 120 | /* Never collapse the sidebar for wide screens */ 121 | display: block; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /samples/TestApplication/wwwroot/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Test Application 6 | 7 | 8 | 9 | 10 | 11 | Loading... 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /samples/TestApplication/wwwroot/sample-data/weather.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Date": "2018-05-06", 4 | "TemperatureC": 1, 5 | "Summary": "Freezing", 6 | "TemperatureF": 33 7 | }, 8 | { 9 | "Date": "2018-05-07", 10 | "TemperatureC": 14, 11 | "Summary": "Bracing", 12 | "TemperatureF": 57 13 | }, 14 | { 15 | "Date": "2018-05-08", 16 | "TemperatureC": -13, 17 | "Summary": "Freezing", 18 | "TemperatureF": 9 19 | }, 20 | { 21 | "Date": "2018-05-09", 22 | "TemperatureC": -16, 23 | "Summary": "Balmy", 24 | "TemperatureF": 4 25 | }, 26 | { 27 | "Date": "2018-05-10", 28 | "TemperatureC": -2, 29 | "Summary": "Chilly", 30 | "TemperatureF": 29 31 | } 32 | ] 33 | -------------------------------------------------------------------------------- /src/BlazorComponents/BlazorComponents.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $([System.DateTime]::Now.ToString(MMddHHmmss)) 5 | 6 | 7 | 8 | netstandard2.0 9 | true 10 | library 11 | 7.3 12 | 0.5 13 | 14 | BlazorComponents 15 | false 16 | 17 | Muqeet Khan 18 | Library of useful components to be used within Blazor. Starting off with a simple ChartJS port to Blazor. 19 | https://github.com/muqeet-khan/BlazorComponents 20 | https://github.com/muqeet-khan/BlazorComponents 21 | Blazor Components;ChartJS;Blazor 22 | Library of useful components to be used within Blazor. Starting off with a simple ChartJS port to Blazor. 23 | Updated to Blazor 0.7.0. 24 | https://opensource.org/licenses/MIT 25 | https://github.com/muqeet-khan/BlazorComponents/blob/master/changelog.md 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 42 | 43 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJSBarChart.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazorComponents.ChartJS 4 | { 5 | public class ChartJSBarChart : IChart 6 | { 7 | public string ChartType { get; set; } = "bar"; 8 | public ChartJsBarData Data { get; set; } 9 | public ChartJsOptions Options { get; set; } 10 | public string CanvasId { get; set; } = $"BlazorChartJS_{new Random().Next(0, 1000000).ToString()}"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJSInterop.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.JSInterop; 2 | using System.Threading.Tasks; 3 | 4 | namespace BlazorComponents.ChartJS 5 | { 6 | public class ChartJSInterop 7 | { 8 | public static Task InitializeLineChart(ChartJSLineChart lineChart) 9 | { 10 | return JSRuntime.Current.InvokeAsync("BlazorComponents.ChartJSInterop.InitializeLineChart", new[] { lineChart }); 11 | } 12 | 13 | public static Task UpdateSize(string canvasId, int newWidth, int newHeight) 14 | { 15 | return JSRuntime.Current.InvokeAsync("BlazorComponents.ChartJSInterop.UpdateSize", new object[] { canvasId, newWidth, newHeight }); 16 | } 17 | 18 | public static Task InitializeBarChart(ChartJSBarChart barChart) 19 | { 20 | return JSRuntime.Current.InvokeAsync("BlazorComponents.ChartJSInterop.InitializeBarChart", new[] { barChart }); 21 | } 22 | 23 | public static Task UpdateLineChart(ChartJSLineChart lineChart) 24 | { 25 | return JSRuntime.Current.InvokeAsync("BlazorComponents.ChartJSInterop.UpdateLineChart", new[] { lineChart }); 26 | } 27 | 28 | public static Task UpdateBarChart(ChartJSBarChart barChart) 29 | { 30 | return JSRuntime.Current.InvokeAsync("BlazorComponents.ChartJSInterop.UpdateBarChart", new[] { barChart }); 31 | } 32 | 33 | public static Task InitializeRadarChart(ChartJSRadarChart radarChart) 34 | { 35 | return JSRuntime.Current.InvokeAsync("BlazorComponents.ChartJSInterop.InitializeRadarChart", new[] { radarChart }); 36 | } 37 | 38 | public static Task UpdateRadarChart(ChartJSRadarChart radarChart) 39 | { 40 | return JSRuntime.Current.InvokeAsync("BlazorComponents.ChartJSInterop.UpdateRadarChart", new[] { radarChart }); 41 | } 42 | 43 | public static Task InitializePieChart(ChartJSPieChart pieChart) 44 | { 45 | return JSRuntime.Current.InvokeAsync("BlazorComponents.ChartJSInterop.InitializePieChart", new[] { pieChart }); 46 | } 47 | 48 | public static Task UpdatePieChart(ChartJSPieChart pieChart) 49 | { 50 | return JSRuntime.Current.InvokeAsync("BlazorComponents.ChartJSInterop.UpdatePieChart", new[] { pieChart }); 51 | } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJSLineChart.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazorComponents.ChartJS 4 | { 5 | public class ChartJSLineChart : IChart 6 | { 7 | public string ChartType { get; set; } = "bar"; 8 | public ChartJsLineData Data { get; set; } 9 | public ChartJsOptions Options { get; set; } 10 | public string CanvasId { get; set; } = $"BlazorChartJS_{new Random().Next(0, 1000000).ToString()}"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJSPieChart.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazorComponents.ChartJS 4 | { 5 | public class ChartJSPieChart : IChart 6 | { 7 | public string ChartType { get; set; } = "pie"; 8 | public ChartJsPieData Data { get; set; } 9 | public ChartJsOptions Options { get; set; } 10 | public string CanvasId { get; set; } = $"BlazorChartJS_{new Random().Next(0, 1000000).ToString()}"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJSRadarChart.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BlazorComponents.ChartJS 4 | { 5 | public class ChartJSRadarChart : IChart 6 | { 7 | public string ChartType { get; set; } = "bar"; 8 | public ChartJsRadarData Data { get; set; } 9 | public ChartJsOptions Options { get; set; } 10 | public string CanvasId { get; set; } = $"BlazorChartJS_{new Random().Next(0, 1000000).ToString()}"; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJSRadarDataset.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorComponents.ChartJS 2 | { 3 | public class ChartJSRadarDataset : ChartJsDataset 4 | { 5 | public int BorderWidth { get; set; } = 1; 6 | public string PointBackgroundColor { get; set; } = "#DB5571"; 7 | public string PointBorderColor { get; set; } = "#6D2A39"; 8 | public int PointBorderWidth { get; set; } = 1; 9 | public int PointRadius { get; set; } = 1; 10 | public RadarChartPointStyles RadarChartPointStyle { get; set; } = RadarChartPointStyles.circle; 11 | public string PointStyle 12 | { 13 | get { return RadarChartPointStyle.ToString(); } 14 | } 15 | } 16 | 17 | public enum RadarChartPointStyles 18 | { 19 | circle, 20 | cross, 21 | crossRot, 22 | dash, 23 | line, 24 | rect, 25 | rectRounded, 26 | rectRot, 27 | star, 28 | triangle, 29 | } 30 | 31 | //public class RadarChartPointStyles 32 | //{ 33 | // const string CIRCLE = "circle"; 34 | // const string CROSS = "cross"; 35 | // const string CROSS_ROT = "crossRot"; 36 | // const string DASH = "dash"; 37 | // const string LINE = "line"; 38 | // const string RECT = "rect"; 39 | // const string RECT_ROUNDED = "rectRounded"; 40 | // const string RECT_ROT = "rectRot"; 41 | // const string STAR = "star"; 42 | // const string TRIANGLE = "triangle"; 43 | 44 | //} 45 | } 46 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsBarData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BlazorComponents.ChartJS 4 | { 5 | public class ChartJsBarData 6 | { 7 | public List Labels { get; set; } = new List(); 8 | public List Datasets { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsBarDataset.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorComponents.ChartJS 2 | { 3 | public class ChartJsBarDataset : ChartJsDataset 4 | { 5 | public int BorderWidth { get; set; } = 1; 6 | public int PointHoverRadius { get; set; } = 1; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BlazorComponents.ChartJS 4 | { 5 | public class ChartJsData where T : ChartJsDataset 6 | { 7 | public List Labels { get; set; } = new List(); 8 | public List Datasets { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsDataLabels.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorComponents.ChartJS 2 | { 3 | public class ChartJsDataLabels 4 | { 5 | /// 6 | /// Should be displayed or not (the data label) 7 | /// 8 | public bool Display { get; set; } = false; 9 | 10 | /// 11 | /// Text Color of the data labels 12 | /// 13 | public string Color { get; set; } = "white"; 14 | 15 | /// 16 | /// Position of the data label (end means above the bar chart for example). 17 | /// 18 | public string Align { get; set; } = "start"; 19 | 20 | public string Anchor { get; set; } = "start"; 21 | 22 | /// 23 | /// Font of the data label text 24 | /// 25 | public ChartJsDataLabelsFont Font { get; set; } = new ChartJsDataLabelsFont(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsDataLabelsFont.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorComponents.ChartJS 2 | { 3 | public class ChartJsDataLabelsFont 4 | { 5 | public string Family { get; set; } = "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif"; 6 | public int Size { get; set; } = 12; 7 | public string Style { get; set; } = "normal"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsDataset.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BlazorComponents.ChartJS 4 | { 5 | public abstract class ChartJsDataset 6 | { 7 | /// 8 | /// The label for the dataset which appears in the legend and tooltips. 9 | /// 10 | public string Label { get; set; } = ""; 11 | /// 12 | /// Actual data. This is an int array. 13 | /// TO-DO: Explore if it makes any sense to have this as decimal. 14 | /// 15 | public List Data { get; set; } = new List(); 16 | /// 17 | /// The fill color under the line. 18 | /// AS-IS: We only accept colors as string values. Normal colors and HTML Hex colors are ok to use. 19 | /// TODO: Accept some form of actual color information rathen than strings. 20 | /// 21 | public List BackgroundColor { get; set; } = new List(); 22 | /// 23 | /// The color of the line 24 | /// AS-IS: We only accept string colors. 25 | /// TODO: Accept some form of actual color information rathen than strings. 26 | /// 27 | public string BorderColor { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsLayout.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorComponents.ChartJS 2 | { 3 | public class ChartJsLayout 4 | { 5 | /// 6 | /// Paddings of the chart for better positioning/good looking chart 7 | /// 8 | public ChartJsPadding Padding { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsLegend.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorComponents.ChartJS 2 | { 3 | public class ChartJsLegend 4 | { 5 | /// 6 | /// Display a legend or not 7 | /// 8 | public bool Display { get; set; } = true; 9 | 10 | /// 11 | /// Sets the position of the legend 12 | /// 13 | public string Position { get; set; } = "top"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsLineData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BlazorComponents.ChartJS 4 | { 5 | public class ChartJsLineData 6 | { 7 | public List Labels { get; set; } = new List(); 8 | public List Datasets { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsLineDataset.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorComponents.ChartJS 2 | { 3 | public class ChartJsLineDataset : ChartJsDataset 4 | { 5 | /// 6 | /// The ID of the x axis to plot this dataset on. If not specified, this defaults to the ID of the first found x axis 7 | /// 8 | public string XAxisID { get; set; } 9 | /// 10 | /// The ID of the y axis to plot this dataset on. If not specified, this defaults to the ID of the first found y axis. 11 | /// 12 | public string YAxisID { get; set; } 13 | /// 14 | /// The width of the line in pixels. 15 | /// 16 | public int BorderWidth { get; set; } = 1; 17 | /// 18 | /// Cap style of the line. 19 | /// 20 | public string BorderCapStyle { get; set; } 21 | /// 22 | /// Line joint style. 23 | /// 24 | public string BorderJoinStyle { get; set; } 25 | /// 26 | /// Algorithm used to interpolate a smooth curve from the discrete data points. 27 | /// 28 | public string CubicInterpolationMode { get; set; } 29 | /// 30 | /// Length and spacing of dashes. It's an int array. Whatever JS! 31 | /// 32 | public int[] BorderDash { get; set; } = new int[] { 0, 0 }; 33 | /// 34 | /// Offset for line dashes. 35 | /// 36 | public int BorderDashOffset { get; set; } 37 | /// 38 | /// The width of the point border in pixels. 39 | /// 40 | public int PointBorderWidth { get; set; } 41 | /// 42 | /// The radius of the point shape. If set to 0, the point is not rendered. 43 | /// 44 | public int PointRadius { get; set; } 45 | /// 46 | /// The pixel size of the non-displayed point that reacts to mouse events. 47 | /// 48 | public int PointHitRadius { get; set; } 49 | /// 50 | /// Border width of point when hovered. 51 | /// 52 | public int PointHoverBorderWidth { get; set; } 53 | /// 54 | /// The radius of the point when hovered. 55 | /// 56 | public int PointHoverRadius { get; set; } 57 | /// 58 | /// How to fill the area under the line. 59 | /// 60 | public bool Fill { get; set; } 61 | /// 62 | /// If false, the line is not drawn for this dataset. 63 | /// Default is true. If you are filling and dont want to show the line, then change to false. 64 | /// 65 | public bool ShowLine { get; set; } = true; 66 | /// 67 | /// If true, lines will be drawn between points with no or null data. If false, points with NaN data will create a break in the line 68 | /// 69 | public bool SpanGaps { get; set; } 70 | /// 71 | /// If the line is shown as a stepped line. 72 | /// 73 | public bool SteppedLine { get; set; } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsOptions.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorComponents.ChartJS 2 | { 3 | public class ChartJsOptions 4 | { 5 | /// 6 | /// Text will not be shown if the title is set. 7 | /// 8 | public string Text { get; set; } = ""; 9 | 10 | /// 11 | /// Show or hide the chart 12 | /// 13 | public bool Display { get; set; } = true; 14 | public int BorderWidth { get; set; } = 1; 15 | /// 16 | /// Need to be true for resizing functions. 17 | /// 18 | public bool Responsive { get; set; } = true; 19 | 20 | /// 21 | /// Options for the axles 22 | /// 23 | public ChartJsScale Scales { get; set; } 24 | 25 | /// 26 | /// Plugin options. NOTE: This will be outsourced/refactored in future versions 27 | /// 28 | public ChartJsPlugins Plugins { get; set; } 29 | 30 | /// 31 | /// Layout options such as padding for the chart. 32 | /// 33 | public ChartJsLayout Layout { get; set; } 34 | 35 | /// 36 | /// Options for the chart legend. 37 | /// 38 | public ChartJsLegend Legend { get; set; } 39 | 40 | /// 41 | /// Sets the title and its options like font size. 42 | /// 43 | public ChartJsTitle Title { get; set; } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsPadding.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorComponents.ChartJS 2 | { 3 | public class ChartJsPadding 4 | { 5 | public int Left { get; set; } = 0; 6 | public int Right { get; set; } = 0; 7 | public int Top { get; set; } = 0; 8 | public int Bottom { get; set; } = 0; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsPieData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BlazorComponents.ChartJS 4 | { 5 | public class ChartJsPieData 6 | { 7 | public List Labels { get; set; } = new List(); 8 | public List Datasets { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsPieDataset.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BlazorComponents.ChartJS 4 | { 5 | public class ChartJsPieDataset : ChartJsDataset 6 | { 7 | ///// 8 | ///// The ID of the x axis to plot this dataset on. If not specified, this defaults to the ID of the first found x axis 9 | ///// 10 | //public string XAxisID { get; set; } 11 | ///// 12 | ///// The ID of the y axis to plot this dataset on. If not specified, this defaults to the ID of the first found y axis. 13 | ///// 14 | //public string YAxisID { get; set; } 15 | ///// 16 | ///// The width of the line in pixels. 17 | ///// 18 | //public int BorderWidth { get; set; } = 1; 19 | ///// 20 | ///// Cap style of the line. 21 | ///// 22 | //public string BorderCapStyle { get; set; } 23 | ///// 24 | ///// Line joint style. 25 | ///// 26 | //public string BorderJoinStyle { get; set; } 27 | ///// 28 | ///// Algorithm used to interpolate a smooth curve from the discrete data points. 29 | ///// 30 | //public string CubicInterpolationMode { get; set; } 31 | ///// 32 | ///// Length and spacing of dashes. It's an int array. Whatever JS! 33 | ///// 34 | //public int[] BorderDash { get; set; } = new int[] { 0, 0 }; 35 | ///// 36 | ///// Offset for line dashes. 37 | ///// 38 | //public int BorderDashOffset { get; set; } 39 | ///// 40 | ///// The width of the point border in pixels. 41 | ///// 42 | //public int PointBorderWidth { get; set; } 43 | ///// 44 | ///// The radius of the point shape. If set to 0, the point is not rendered. 45 | ///// 46 | //public int PointRadius { get; set; } 47 | ///// 48 | ///// The pixel size of the non-displayed point that reacts to mouse events. 49 | ///// 50 | //public int PointHitRadius { get; set; } 51 | ///// 52 | ///// Border width of point when hovered. 53 | ///// 54 | //public int PointHoverBorderWidth { get; set; } 55 | ///// 56 | ///// The radius of the point when hovered. 57 | ///// 58 | //public int PointHoverRadius { get; set; } 59 | ///// 60 | ///// How to fill the area under the line. 61 | ///// 62 | //public bool Fill { get; set; } 63 | ///// 64 | ///// If false, the line is not drawn for this dataset. 65 | ///// Default is true. If you are filling and dont want to show the line, then change to false. 66 | ///// 67 | //public bool ShowLine { get; set; } = true; 68 | ///// 69 | ///// If true, lines will be drawn between points with no or null data. If false, points with NaN data will create a break in the line 70 | ///// 71 | //public bool SpanGaps { get; set; } 72 | ///// 73 | ///// If the line is shown as a stepped line. 74 | ///// 75 | //public bool SteppedLine { get; set; } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsPlugins.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorComponents.ChartJS 2 | { 3 | public class ChartJsPlugins 4 | { 5 | /// 6 | /// The data labels plugin (https://github.com/chartjs/chartjs-plugin-datalabels) option object 7 | /// 8 | public ChartJsDataLabels Datalabels { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsRadarData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BlazorComponents.ChartJS 4 | { 5 | public class ChartJsRadarData 6 | { 7 | public List Labels { get; set; } = new List(); 8 | public List Datasets { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsScale.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BlazorComponents.ChartJS 4 | { 5 | public class ChartJsScale 6 | { 7 | /// 8 | /// Options for the X axis. 9 | /// 10 | public List XAxes { get; set; } 11 | 12 | /// 13 | /// Options for the Y axis. 14 | /// 15 | public List YAxes { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsTicks.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorComponents.ChartJS 2 | { 3 | public class ChartJsTicks 4 | { 5 | public bool BeginAtZero { get; set; } = false; 6 | public int FontSize { get; set; } = 14; 7 | public int Max { get; set; } = 100; 8 | public string FontColor { get; set; } = "#000000"; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsTitle.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorComponents.ChartJS 2 | { 3 | public class ChartJsTitle 4 | { 5 | /// 6 | /// Set true for displaying a title 7 | /// 8 | public bool Display { get; set; } = false; 9 | 10 | /// 11 | /// Sets the title 12 | /// 13 | public string Text { get; set; } = string.Empty; 14 | public int FontSize { get; set; } = 14; 15 | public string FontColor { get; set; } = "black"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsXAxes.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorComponents.ChartJS 2 | { 3 | public class ChartJsXAxes 4 | { 5 | public ChartJsTicks Ticks { get; set; } 6 | public string Position { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartJsyAxes.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorComponents.ChartJS 2 | { 3 | public class ChartJsYAxes 4 | { 5 | public ChartJsTicks Ticks { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/ChartTypes.cs: -------------------------------------------------------------------------------- 1 | namespace BlazorComponents.ChartJS 2 | { 3 | public enum ChartTypes 4 | { 5 | Bar, 6 | Line, 7 | Pie, 8 | Radar 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/BlazorComponents/ChartJS/IChart.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace BlazorComponents.ChartJS 7 | { 8 | /// 9 | /// Contains the minimum rquirements for a chart object. 10 | /// 11 | public interface IChart 12 | { 13 | 14 | string CanvasId { get; set; } 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/BlazorComponents/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:57563/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "BlazorComponents": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "environmentVariables": { 22 | "ASPNETCORE_ENVIRONMENT": "Development" 23 | }, 24 | "applicationUrl": "http://localhost:57564/" 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/BlazorComponents/Shared/ChartBase.cs: -------------------------------------------------------------------------------- 1 | using BlazorComponents.ChartJS; 2 | using Microsoft.AspNetCore.Blazor.Components; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | 8 | namespace BlazorComponents.Shared 9 | { 10 | public abstract class ChartBase : BlazorComponent 11 | { 12 | 13 | [Parameter] 14 | protected int Width { get; set; } = 200; 15 | 16 | [Parameter] 17 | protected int Height { get; set; } = 200; 18 | 19 | protected abstract IChart GetChart(); 20 | 21 | /// 22 | /// Updates the size of the chart. 23 | /// 24 | /// 25 | /// 26 | public void UpdateSize(int newWidth, int newHeight) 27 | { 28 | ChartJSInterop.UpdateSize(GetChart().CanvasId, newWidth, newHeight); 29 | } 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/BlazorComponents/Shared/ChartJsBarChart.cshtml: -------------------------------------------------------------------------------- 1 | @using BlazorComponents.ChartJS 2 | @using Microsoft.AspNetCore.Blazor.Components 3 | 4 | @inherits ChartBase 5 | 6 |
7 |
8 | 9 |
10 |
11 | @functions { 12 | 13 | [Parameter] 14 | ChartJSBarChart Chart { get; set; } 15 | 16 | protected override void OnAfterRender() 17 | { 18 | ChartJSInterop.InitializeBarChart(Chart); 19 | } 20 | 21 | protected override IChart GetChart() 22 | { 23 | return Chart; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/BlazorComponents/Shared/ChartJsLineChart.cshtml: -------------------------------------------------------------------------------- 1 | @using BlazorComponents.ChartJS 2 | @using Microsoft.AspNetCore.Blazor.Components 3 | 4 | @inherits ChartBase 5 | 6 |
7 |
8 | 9 |
10 |
11 | @functions { 12 | 13 | [Parameter] 14 | ChartJSLineChart Chart { get; set; } 15 | 16 | protected override void OnAfterRender() 17 | { 18 | ChartJSInterop.InitializeLineChart(Chart); 19 | } 20 | 21 | void DisplayChart() 22 | { 23 | ChartJSInterop.InitializeLineChart(Chart); 24 | } 25 | 26 | public void UpdateChart(ChartJSLineChart updatedChart) 27 | { 28 | ChartJSInterop.UpdateLineChart(updatedChart); 29 | } 30 | 31 | protected override IChart GetChart() 32 | { 33 | return Chart; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/BlazorComponents/Shared/ChartJsPieChart.cshtml: -------------------------------------------------------------------------------- 1 | @using BlazorComponents.ChartJS 2 | @using Microsoft.AspNetCore.Blazor.Components 3 | 4 | @inherits ChartBase 5 | 6 |
7 |
8 | 9 |
10 |
11 | 12 | @functions { 13 | 14 | [Parameter] 15 | ChartJSPieChart Chart { get; set; } 16 | 17 | protected override void OnAfterRender() 18 | { 19 | ChartJSInterop.InitializePieChart(Chart); 20 | } 21 | 22 | public void UpdateChart(ChartJSPieChart updatedChart) 23 | { 24 | ChartJSInterop.UpdatePieChart(updatedChart); 25 | } 26 | 27 | protected override IChart GetChart() 28 | { 29 | return Chart; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/BlazorComponents/Shared/ChartJsRadarChart.cshtml: -------------------------------------------------------------------------------- 1 | @using BlazorComponents.ChartJS 2 | @using Microsoft.AspNetCore.Blazor.Components 3 | 4 | @inherits ChartBase 5 | 6 |
7 |
8 | 9 |
10 |
11 | @functions { 12 | 13 | [Parameter] 14 | ChartJSRadarChart Chart { get; set; } 15 | 16 | protected override void OnAfterRender() 17 | { 18 | ChartJSInterop.InitializeRadarChart(Chart); 19 | } 20 | 21 | public void UpdateChart(ChartJSRadarChart updatedChart) 22 | { 23 | ChartJSInterop.UpdateRadarChart(updatedChart); 24 | } 25 | 26 | protected override IChart GetChart() 27 | { 28 | return Chart; 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /src/BlazorComponents/dist/BlazorComponents.js: -------------------------------------------------------------------------------- 1 |  2 | window.BlazorComponents = window.BlazorComponents || {}; 3 | window.BlazorComponents.BlazorCharts = []; 4 | window.BlazorComponents.ChartJSInterop = { 5 | InitializeBarChart: function (data) { 6 | if (window.BlazorComponents.BlazorCharts.length > 0) { 7 | if (!window.BlazorComponents.BlazorCharts.find(currentChart => currentChart.id === data.canvasId)) { 8 | let thisChart = initializeChartjsChart(data, 'bar'); 9 | window.BlazorComponents.BlazorCharts.push({ id: data.canvasId, chart: thisChart }); 10 | } else { 11 | let myChart = window.BlazorComponents.BlazorCharts.find(currentChart => currentChart.id === data.canvasId); 12 | let myChartIndex = window.BlazorComponents.BlazorCharts.findIndex(currentChart => currentChart.id === data.canvasId); 13 | 14 | if (myChartIndex !== -1) { 15 | myChart.chart.destroy(); 16 | window.BlazorComponents.BlazorCharts.splice(myChartIndex, 1); 17 | let thisChart = initializeChartjsChart(data, 'bar'); 18 | window.BlazorComponents.BlazorCharts.push({ id: data.canvasId, chart: thisChart }); 19 | } 20 | } 21 | } 22 | else { 23 | let thisChart = initializeChartjsChart(data, 'bar'); 24 | window.BlazorComponents.BlazorCharts.push({ id: data.canvasId, chart: thisChart }); 25 | } 26 | 27 | return true; 28 | }, 29 | InitializeLineChart: function (data) { 30 | if (window.BlazorComponents.BlazorCharts.length > 0) { 31 | if (!window.BlazorComponents.BlazorCharts.find(currentChart => currentChart.id === data.canvasId)) { 32 | let thisChart = initializeChartjsChart(data, 'line'); 33 | window.BlazorComponents.BlazorCharts.push({ id: data.canvasId, chart: thisChart }); 34 | } else { 35 | 36 | let myChart = window.BlazorComponents.BlazorCharts.find(currentChart => currentChart.id === data.canvasId); 37 | let myChartIndex = window.BlazorComponents.BlazorCharts.findIndex(currentChart => currentChart.id === data.canvasId); 38 | 39 | if (myChartIndex !== -1) { 40 | myChart.chart.destroy(); 41 | window.BlazorComponents.BlazorCharts.splice(myChartIndex, 1); 42 | let thisChart = initializeChartjsChart(data, 'line'); 43 | window.BlazorComponents.BlazorCharts.push({ id: data.canvasId, chart: thisChart }); 44 | } 45 | } 46 | } 47 | else { 48 | let thisChart = initializeChartjsChart(data, 'line'); 49 | window.BlazorComponents.BlazorCharts.push({ id: data.canvasId, chart: thisChart }); 50 | } 51 | 52 | return true; 53 | }, 54 | InitializeRadarChart: function (data) { 55 | if (window.BlazorComponents.BlazorCharts.length > 0) { 56 | if (!window.BlazorComponents.BlazorCharts.find(currentChart => currentChart.id === data.canvasId)) { 57 | let thisChart = initializeChartjsChart(data, 'radar'); 58 | window.BlazorComponents.BlazorCharts.push({ id: data.canvasId, chart: thisChart }); 59 | } else { 60 | 61 | let myChart = window.BlazorComponents.BlazorCharts.find(currentChart => currentChart.id === data.canvasId); 62 | 63 | let myChartIndex = window.BlazorComponents.BlazorCharts.findIndex(currentChart => currentChart.id === data.canvasId); 64 | 65 | if (myChartIndex !== -1) { 66 | myChart.chart.destroy(); 67 | window.BlazorComponents.BlazorCharts.splice(myChartIndex, 1); 68 | let thisChart = initializeChartjsChart(data, 'radar'); 69 | window.BlazorComponents.BlazorCharts.push({ id: data.canvasId, chart: thisChart }); 70 | } 71 | } 72 | } 73 | else { 74 | let thisChart = initializeChartjsChart(data, 'radar'); 75 | window.BlazorComponents.BlazorCharts.push({ id: data.canvasId, chart: thisChart }); 76 | } 77 | 78 | return true; 79 | }, 80 | InitializePieChart: function (data) { 81 | if (window.BlazorComponents.BlazorCharts.length > 0) { 82 | if (!window.BlazorComponents.BlazorCharts.find(currentChart => currentChart.id === data.canvasId)) { 83 | let thisChart = initializeChartjsChart(data, 'pie'); 84 | window.BlazorComponents.BlazorCharts.push({ id: data.canvasId, chart: thisChart }); 85 | } else { 86 | 87 | let myChart = window.BlazorComponents.BlazorCharts.find(currentChart => currentChart.id === data.canvasId); 88 | 89 | let myChartIndex = window.BlazorComponents.BlazorCharts.findIndex(currentChart => currentChart.id === data.canvasId); 90 | 91 | if (myChartIndex !== -1) { 92 | myChart.chart.destroy(); 93 | window.BlazorComponents.BlazorCharts.splice(myChartIndex, 1); 94 | let thisChart = initializeChartjsChart(data, 'pie'); 95 | window.BlazorComponents.BlazorCharts.push({ id: data.canvasId, chart: thisChart }); 96 | } 97 | } 98 | } 99 | else { 100 | let thisChart = initializeChartjsChart(data, 'pie'); 101 | window.BlazorComponents.BlazorCharts.push({ id: data.canvasId, chart: thisChart }); 102 | } 103 | 104 | return true; 105 | }, 106 | UpdateSize: function (canvasId, newWidth, newHeight) { 107 | let ctx = document.getElementById(canvasId); 108 | if (ctx) { 109 | ctx.width = newWidth; 110 | ctx.height = newHeight; 111 | } 112 | 113 | return true; 114 | } 115 | //UpdateLineChart: function (data) { 116 | 117 | // return true; 118 | //}, 119 | //UpdateBarChart: function (data) { 120 | 121 | // if (!window.BlazorComponents.BlazorCharts.find(currentChart => currentChart.id === data.canvasId)) 122 | // throw `Could not find a chart with the given id. ${canvasId}`; 123 | 124 | // let myChart = window.BlazorComponents.BlazorCharts.find(currentChart => currentChart.id === data.canvasId); 125 | 126 | // let myChartIndex = window.BlazorComponents.BlazorCharts.findIndex(currentChart => currentChart.id === data.canvasId); 127 | 128 | // if (myChartIndex !== -1) { 129 | // myChart.chart.destroy(); 130 | // window.BlazorComponents.BlazorCharts.splice(myChartIndex, 1); 131 | // } 132 | 133 | // let thisChart = initializeChartjsChart(data, 'bar'); 134 | // window.BlazorComponents.BlazorCharts.push({ id: data.canvasId, chart: thisChart }); 135 | // return true; 136 | //}, 137 | //UpdateRadarChart: function (data) { 138 | 139 | // return true; 140 | //} 141 | }; 142 | 143 | 144 | function initializeChartjsChart(data, type) { 145 | 146 | let ctx = document.getElementById(data.canvasId); 147 | 148 | data.data.datasets.forEach((item, i) => { 149 | if (item.backgroundColor.length === 1) { 150 | item.backgroundColor = item.backgroundColor[0]; 151 | } 152 | 153 | }); 154 | 155 | let myChart = new Chart(ctx, { 156 | type: type, 157 | data: data.data, 158 | options: data.options 159 | }); 160 | 161 | return myChart; 162 | } --------------------------------------------------------------------------------