Displaying our “R – Quality Control Individual Range Chart Made Nice” inside a Java web App using AJAX – How To.
This article is originally published at https://laranikalranalytics.blogspot.com/
- What you should have installed:
- Java, it can be OpenJDK, you can get it from here: https://github.com/ojdkbuild/ojdkbuild
- Tomcat, any version from 8 up.
- Eclipse EE: Eclipse IDE for Java EE.
- Spring Tools Suite For Eclipse: https://spring.io/tools. You can install it from Eclipse Marketplace.
- R: https://www.r-project.org. Inside R, at least these packages:
- install.packages( "tidyverse", dependencies = TRUE )
- install.packages( "rmarkdown", dependencies = TRUE )
- install.packages( "dygraphs", dependencies = TRUE )
- install.packages( "qcc", dependencies = TRUE )
- install.packages( "rattle", dependencies = TRUE )
- install.packages( "Rcmdr", dependencies = TRUE )
- install.packages( "stlplus", dependencies = TRUE )
- Java web development with Spring.
- Ajax, at least the concept.
- Thymeleaf, at least the template concept: https://www.thymeleaf.org.
- R and the R related tools mentioned above.
- SPC, it is important for you to read my article: R - Quality Control Individual Range Chart Made Nice.
- Download the zip file: R-ANALYTICS-master.zip
- Unzip it to a local folder.
- Double-click on file: R-ANALYTICS.Rproj, it will start rstudio.
- On the right-below pane, click on files, you will see your files, click on file name: QualityControl_IndividualRangeChart.Rmd, rstudio will open the file:
- To generate the html file from the Rmarkdown file, click on Knit->Knit to HTML.
- Now you should be able to see your Intermediate Range Chart html file, like this:
- Creating the project in eclipse EE IDE:
- Using your file explorer, create a folder called rchart inside your eclipse EE workspace folder.
- Open file rchart-master.zip
- Extract the content of rchart-master folder inside the zip file into the new rchart folder you just created.
- Start Eclipse EE IDE and go to File-New-Java Project:.
- Enter the name of the project as rchart and click Finish:
- Once the project has been added, open it and double click on your pom.xml file to edit the Tomcat path according to your Tomcat path and save your changes:
- Right-Click on your pom.xml file and Select Run As -> Maven build:
- When Eclipse asks to edit the launch configuration, enter eclipse:eclipse as the Goals and click Run:
- Now let's create the war file, Right-Click on your pom.xml file and Select Run As -> Maven install:
- Go to your web browser and point it to http://localhost:8080/RChartFromJava, verify the Rscript path and set it accordingly - "C:\\Program Files\\R\\R-3.5.1\\bin\\Rscript" - and click on the Display Chart button, now you should be able to see the Intermediate Range Chart of the data in the text area:
More information about R:
Please visit source website for post related comments.