Facebook Pixel

C#, SignalR and MySQL Integration Template

This example shows how to use AnyChart library with the C# programming language using ASP.NET, SignalR library and MySQL database.
View on GitHub

Running

This example uses .NET framework 4.6.1, ASP.NET 4.0.30319, ASP.NET MVC 5.2, SignalR 2.2.1, Visual Studio 2015 Community, MySQL 5.6 and MySQL Connector/NET 6.9.9.0 - ADO.NET driver for MySQL. To check your installations, please, use Windows Control Panel -> Programs and features. If you miss some installations, please, visit:
MySQL download page and installation instructions to setup MySQL;
Visual Studio download page to install Visual Studio, .NET framework and ASP.NET;
Connector/Net download page to install MySQL Connector/NET.

To start this example run commands listed below.

Clone the repository from github.com to your working directory:


$ git clone git@github.com:anychart-integrations/asp-net-signalr-mysql-template.git
                

Open cmd console in 'asp-net-signalr-mysql-template' folder and set up MySQL database, use -u -p flags to provide username and password:


$  "[YOUR_PATH_TO_MYSQL]\bin\mysql.exe" -u[USER_NAME] -p < database_backup.sql
e.g:
$  "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysql.exe" -uroot -p < database_backup.sql
                

Open project in Visual Studio using AspNetSignalRMysqlTemplate.sln solution file

Run application using Run button or press F5

If you have some problems with MySQL connection, ensure that MySql.Data.Entity.EF6 in References has correct path to MySql.Data.Entity.EF6.dll

Now you can update MySQL database data, run:


$  "[YOUR_PATH_TO_MYSQL]\bin\mysql.exe" -u[USER_NAME] -p < database_update.sql
e.g:
$  "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysql.exe" -uroot -p < database_update.sql
                    

The chart on web page will be updated automatically.


Workspace

Your workspace should look like:


AspNetSignalRMysqlTemplate/
    App_Data/
    App_Start/
        RouteConfig.cs          # app routes
    Controllers/
        ChartController.cs      # main controller
    Css/
        style.css               # main css file
    Hubs/
        ChartHub.cs             # SignalR chart hub
    Models/
        fruit.cs                # Entity framework model for MySQL
        FruitDBContext.cs       # DB data provider
    Scripts/
        jquery-1.12.4.intellisense.js
        jquery-1.12.4.js
        jquery-1.12.4.min.js
        jquery-1.12.4.min.map
        jquery.signalR-2.2.1.js
        jquery.signalR-2.2.1.min.js
    Views/
        Chart/
            Index.cshtml        # html template
        web.config
    Global.asax
    packages.config
    Startup.cs                  # Owin app startup
    Web.config                  # main ASP.NET project settings
                    

Technologies


Further Learning


License

AnyChart ASP.NET/SignalR/C#/MySQL integration sample includes two parts:

  • Code of the integration sample that allows to use Javascript library (in this case, AnyChart) with ASP.NET framework, SignalR library, C# language and MySQL database. You can use, edit, modify it, use it with other Javascript libraries without any restrictions. It is released under Apache 2.0 License.
  • AnyChart JavaScript library. It is released under Commercial license. You can test this plugin with the trial version of AnyChart. Our trial version is not limited by time and doesn't contain any feature limitations. Check details here.

If you have any questions regarding licensing - please contact us. sales@anychart.com