Connecting to a database to create a graph - javascript

Currently, I have connected to my database in MYSQL using JSP code. However, my next step would be to use something like Plotly.js to create a graph. However, I can't seem to be able to transfer values that I retrieve through JSP into javascript where Plotly is to create the graph. I also want my graph to be dynamic in the sense that I can run my program and it'll update it with the changes to the database. I hear that transferring values from JSP to javascript isn't recommended so I was wondering what is an efficient strategy to solve my problem?

Related

Timed Based Graph Plotting Python Django Using Firebase

I am using Django to make a dashboard to show sensor data.
I am using chart.js for that
I am retrieving sensor data of two days or less only.
The problem is that how can I divide my graph for it.I think it might be possible using python time library or Django or something like that if so kindly suggest me some way to do it.
I think that if java script can help us that will be great too.
I just want data parsing based on time to plot and view it nicely.

Cache - How to use it? (in firebase for a beginner)

I as a beginner struggle a lot to figure out how you can save reads of data which is constantly queried. Does anybody has some good resources to learn about this. Currently I have a list of exercises, which is frequently refreshed, but the reads are much more compared to the writes. I set it up on firestore and always serve it through ejs (template engine) to my modal. Instead of always querying the same data all the time to my template, can I save the results and just serve them? I could also serve it statically, which wouldn't be so dynamic as it's made by hand. But I could then save a lot of reads and just query the newly added (creation Date after I implemented the data static),or?
In my project I am using just plain HTML and plain JavaScript (Cloud Functions with express)
Is there no common practice for this kind of situation? You could also save the data like every hour on Google cloud platform as a JSON tree and then read it from there? Would save a lot of reads or you could make something like a load more button, where only the first 20 results are loaded ( but this would make the user experience a little tricky and not so likable..)

Is it possible to pass values from java script to an excel file to run a function in excel and retrieve data

I'm using an excel file where it has some functions regarding a calculation.a custom made function to calculate an amount by inputting some values for 4 cell inputs.I don't know how to implement the formula by javascript, the formula is complex.is there any way that i can pass the values from my web page to the excel file and do the calculation from the excel file it self and retrieve the values and show them on the web page. what is the best solution or the approach for the given problem?
Thanks!
I fear, the easiest way to do this would be to implement the formula in Javascript. As far as I know, Javascript can do everything, Excel can do.
Depending on your website's architecture you wouldn't be able to execute anything on the server and even if you do, the Excel-file doesn't do the calculations, but Excel itself does. So the file wouldn't help you without an actual Excel-installation.
On top of that, Javascript has very limited access to the users harddrive, so you wouldn't be able to download the Excel-file and execute it. It would also depend on the user to have Excel installed.
Depending on the Server you use, you could also use PHP, Java or C# for the calculation, but I think Javascript should suffice for most cases.

JS based NVD3 chart in java ee with jsf bad idea?

I want to implement a xhtml Page in my Java EE project, which will show data from a db. The chart I had an eye one was NVD3 charts, which is based on java script.
The implementation I had in mind was like this:
User can fill in textfields with a "from-date" and a "to-date" to set the date-range where data from the database should be collected. The collected data will then be marshalled into JSON format and the chart created based on the data. Here I somehow have to get the marshalled data from Java to the JS function.
I guess I could this get to work, I am quite a fan of the NVD3 charts but somehow this mixing of JavaEE with JSF and javascript seems bad practice to me.
I wanted to know if this is kind of a bad idea to do and what you would advise me to do here?
Thanks in advance

Auto generating graph for website

I'm using java spring for backend of my website. I need to add some auto generating graphs to it. But I'm not sure for what I should look for. Should I use a Javascript library or can I do it in java as a backend function? This is my first time using this functionality.
P.S.
I have to deal with a often updating database to fetch data for those graphs.
Check this answer, I would suggest to go with option 2 and use a javascript library like highcharts.
Plot Graph In web application

Categories