Web site/app - Real-Time Charting Advice (mySQL, JS, PHP?) - javascript

I'm working on a project to create real-time charts from data in an SQL database. I've done a lot of research on JS charting libraries and have picked out a few good ones.
My problem is that I'm not sure how to get started with linking the SQL data to the web app/site.
My HTML and CSS are fine. I'm coming on with JS and we have software that provides me with necessary SQL query code.
Where is the gap in my knowledge? Is it necessary to learn PHP in order to get this working? How about C#?
My solution will currently be a locally hosted site, running on a networked computer (not currently got server space). The solution I have already uses Excel to query the database and runs a ton of macros to generate static charts every ten minutes. This works, but I'd like to create something far more flexible, robust and interactive.
Could anybody point me to any online resources that may help me? I like ChartJS but any open-source charting library will do. I'm hoping there's a great tutorial somewhere that covers SQL to real-time charts but I just can't find one...

If you want a real time charting you need to receive information from the DB almost every second. So sending a bunch of requests is not the best way to do this. You probably need to read about websockets and how do they work. Here is an example but you may find a lot more in google. If you don't want to do it with PHP, I can assure you that it would be far more easier with node.js

Related

Persisting data with js for a small web project without a database

I recently started developing my first (rather crappy) webpage. It is for my commune that just displays who has to clean the kitchen on a given day and a picture of him. Now I would also like to make a little rating system, where you can give a rating between 1 and 5 starts. Is there any way to persist the rating without using a database? Could I, for example, just save it to a textfile that i read to and write from?
edit:
The website is hosted on an apache server
The short answer is no.
To store anything on the server, you're going to need to learn a server-side language, like PHP, C#, or Java. Any server framework will already have stuff built in for working with a database, so if you go and reinvent your own, you'll just be creating more work for yourself. If I were you, I'd start with some simple tutorials for your server language of choice.
Also consider that even a simple rating system isn't as trivial as you might think. Some things you may want:
Authentication: should everyone in the world be able to access your site?
Permissions: can anyone update any rating?

Selection of technology implementation?

I need to develop a small application integrated in sharepoint. I am using the 2019 version on on premise. The application consists of data entry, sql queries for loading data into the fields. I want to use the latest approaches for this purpose. I still have time, but I don’t know which way to go.
I looked at a lot of solutions without code, but as I understand it, I need to move in the direction of JS, at the same time I want to save it in sharepoint lists or where to store the entered data. But how can I get data from the external MSSQL database, use node.js or the web part, REST. I am very confused, help me please. I developed applications on C # windows form with ado.net, if I know the direction I will figure it out in JS.
So following up with the comments, you could implement the following stack:
React or Vue: To implement a simple GUI to perform basic CRUD on you DB
NodeJS: To handle the data manipulation (if any) and push things to Sharepoint
Take a look at the very popular MERV stack for inspiration on the app structure. (MERV uses MongoDB, but the logic would be the same if you swap that bit for MySQL)
Using NodeJS you can leverage Sharepoint REST API using the available libraries. Check out this tutorial for details on the implementation.

Send data from Python to Javascript via network connection

This is more a general question, I'm not asking for implementation details.
I have a Python script running on a machine which monitors an experiment and gathers live data from it. I want to visualise the data on a website and decided to go with d3.js
My current setup however is absolutely basic:
The python script is running in an endless loop and appends new data
to a text-file (CSV file).
There is an HTML-page on the web
server with a javascript, which grabs the file and creates a graph
using d3.js.
I already thought about replacing the text-file with a sqlite database, but I'm sure there is a more sophisticated and easy way to do it via network.
So I am looking for a more solid solution and searched the web for different kind of strategies but most of those involve bigger libraries (Tornado, node.js etc.).
I would be happy with quite basic socket-like solution and tried to figure out how it would work with WebSockets but not sure how to handle this.
So my question is, what kind of design would you recommend or use if your only goal is to have a Javascript running in a browser and waiting/listening for data (let's say every few seconds a float), which is sent from a Python script?

Passing values from Python to JavaScript

For a research project we are developing a system in python which takes raw data from a real time sensor and applies different DSP filters to it. So far so good. The other part of the system should be the plotting of the data and the access to some controllers for modifying the sample rate and other parameters. The last days I have been trying to use HTML5 + javascript as the technology to do the data plotting; I am using d3.js for the graphics and mimic.js to implement the xmlrpc protocol to communicate the python side with the HTML file. After a lot of tweaking i ALMOST managed to communicate both parts of the system. However, I ran into the 'Cross origin request' error (I am using chrome).
After that I have been thinking of some other strategies in order to communicate python with the GUI:
Using a SimpleHTTPServer. However, I need to have a SimpleXMLRPCServer running so I can register the function (register_function) to pass the value. Is there a way to implement a xmlrpc within a SimpleHTTPServer?
I have been thinking about using json but I am not sure if this is the best way to go as the data streaming will be quite big and fast(4 channels with constant updates).
So after all this testing I really would appreciate a piece of advice:
Is if feasible to have such HTML5 GUI? is it efficient for plotting such amounts of data?
if so, what would be a realistic strategy to implement a communication between Python and HTML/js?
Is xmlrpc the best protocol to use?
Yep. Also you can use some JavaScript charts libraries. Such as amCharts, highcharts, plot.
Really, JSON is better.
XMLRPC isn't very light. See p.2 :)

Best Way to Transfer Data to and from a MySQL Database

I wonder whether someone may be able to help me please. For a while now I've been working on the Javascript and HTML elements of the Google Maps V3 api. I now want to look at how I'm going to transfer the data to and from MySQL database.
I've read quite a lot of documentation on the Internet on the various methods of transferring this information but I'm not too sure of the best route to take.
I just wondered whether it would be possible that someone with a lot more experience than I could perhaps give me a bit of advice and direction please on the best way to transfer this data.
Many thanks and kind regards
it's a fairly broad question, but mostly dependent on your implementation. Are you already interfacing with the API using a server side language, or just all with Javascript? If everything is being done on the client side, then you would want to consider some sort of AJAX/form functionality to get the data from the client to a server side script. If you are doing any of this on the server side, then you can cut out the AJAX middle man and run SQL commands via PHP or whatnot as you are interfacing with the API.
I would recomend MySQl Dump. Its fairly simple and there is plenty of documentation on how to do it.

Categories