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

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

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.

Connecting to a database to create a graph

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?

Extract data from javascript chart

I'm trying to start a project regarding a stock trading tool. I would like to extract data from an existing stock chart online. However, I thought it would be easy as parsing HTML code, but I noticed that most of them are made of javascript which I am not familiar with.
I'll be using python 3.4 for this project.
Any starting ideas would be deeply appreciated!
Cheers!

Java object to javascript

I have a core java project, in which I have to create a data visualization in form of a graph.
This data visualization (a graph) is dumped in HTML file(in Plantuml format), which renders the graph in visual graph.
Now I am looking for a way where I can dump this graph data structure as well(which is actually interlinked java objects) in some format, such that I can read it in java script/jquery thereby reconstructing the whole graph, along with loading the HTML file and update the graph in HTML dynamically, using the graph data structure based on some input from user.
Since plantuml doesn't support dynamic events.
And since the HTML file generated dynamically, so creating JSP and dynamically loading it on server is not feasible.
I have seen some answers suggesting use of JAXB, JSON, but the question wasn't exactly as I needed.
I am thinking to dump it in xml and then read that xml in java script.But not sure how good this idea is.
Is there a better way?
JavaScript is not good at reading XML. The ECMA-357 standard was designed for this, but is all but forgotten. You can still find it in Rhino, but that doesn't suit your purposes.
JSON is really the language to use these days.
GSON or Jackson are common libraries for turning Java objects into JSON.
ECMA-357 - E4X
GSON
Jackson

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