ScatterPlot using jsp

ScatterPlot using jsp

hi, can anybody provide me code for ScatterPlot using jsp.

thanks,

View Answers

August 9, 2011 at 4:16 PM

<%@page import="java.awt.RenderingHints"%>
<%@page import="org.jfree.chart.ChartFrame"%>
<%@page import=" org.jfree.chart.ChartPanel"%>
<%@page import=" org.jfree.chart.JFreeChart"%>
<%@page import=" org.jfree.chart.axis.NumberAxis"%>
<%@page import=" org.jfree.chart.plot.FastScatterPlot"%>
<%@page import=" org.jfree.ui.ApplicationFrame"%>
<%@page import=" org.jfree.ui.RefineryUtilities"%>

<%
         int COUNT = 500000;
         float[][] data = new float[2][COUNT];
         for (int i = 0; i < data[0].length; i++) {
            final float x = (float) i + 100000;
            data[0][i] = x;
            data[1][i] = 100000 + (float) Math.random() * COUNT;
        }
        final NumberAxis domainAxis = new NumberAxis("X");
        domainAxis.setAutoRangeIncludesZero(false);
        final NumberAxis rangeAxis = new NumberAxis("Y");
        rangeAxis.setAutoRangeIncludesZero(false);
        final FastScatterPlot plot = new FastScatterPlot(data, domainAxis, rangeAxis);
        final JFreeChart chart = new JFreeChart(" Scatter Graph ", plot);
        chart.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        ChartFrame frame1=new ChartFrame("Scatter Chart",chart);
        frame1.setVisible(true);
        frame1.setSize(500,300);

   %>

August 9, 2011 at 5:05 PM

hi, thanks a lot for your code. i used this code and for data i used database connections. but iam not getting the graph.

plz find out my mistake..

 <%@page import="java.awt.RenderingHints"%>
<%@page import="org.jfree.chart.ChartFrame"%>
<%@page import=" org.jfree.chart.ChartPanel"%>
<%@page import=" org.jfree.chart.JFreeChart"%>
<%@page import=" org.jfree.chart.axis.NumberAxis"%>
<%@page import=" org.jfree.chart.plot.FastScatterPlot"%>
<%@page import=" org.jfree.ui.ApplicationFrame"%>
<%@page import=" org.jfree.ui.RefineryUtilities"%>
<%@page import="java.sql.*"%>               
<%
try
{

String connectionURL = "jdbc:mysql://localhost:3306/mysql";
Connection con;
Class.forName("com.mysql.jdbc.Driver");
// Get a Connection to the database
con = DriverManager.getConnection(connectionURL, "root", "root"); 
//Add the data into the database
String sql = "SELECT COUNT(*) FROM GRAPH";
Statement stm = con.createStatement();
stm.executeQuery(sql);
ResultSet rs= stm.getResultSet();

while (rs.next ()){
int count=rs.getInt(1);
 System.out.println(count);
 String sql1 = "SELECT XAXIS,YAXIS FROM GRAPH";
 Statement stm1 = con.createStatement();
 stm1.executeQuery(sql1);
 ResultSet rs1= stm1.getResultSet();

 while (rs1.next ()){
 double[][] data = new double[2][count];
 for(int k=0; k<=data[0].length; k++)
    {

                data[0][k] = rs1.getInt(1);
                data[1][k] = rs1.getInt(2);


            }





        final NumberAxis domainAxis = new NumberAxis("X");
        domainAxis.setAutoRangeIncludesZero(false);
        final NumberAxis rangeAxis = new NumberAxis("Y");
        rangeAxis.setAutoRangeIncludesZero(false);
        final FastScatterPlot plot = new FastScatterPlot(data, domainAxis, rangeAxis);
        final JFreeChart chart = new JFreeChart(" Scatter Graph ", plot);
        chart.getRenderingHints().put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        ChartFrame frame1=new ChartFrame("Scatter Chart",chart);
        frame1.setVisible(true);
        frame1.setSize(500,300);

}
}

}

catch(Exception e){
    System.out.println(e);
       }


   %>

thanks,

Ads









Related Tutorials/Questions & Answers:
ScatterPlot using jsp
ScatterPlot using jsp  hi, can anybody provide me code for ScatterPlot using jsp. thanks
Is JSF using JSP?
Is JSF using JSP?  Is JSF using JSP
Advertisements
tree using jsp code
tree using jsp code  i want to draw a tree structure of a family hierarchy using jsp code
A Java Program by using JSP
A Java Program by using JSP  how to draw lines by using JSP plz show me the solution by using program
generate charts using JSP
generate charts using JSP  any one know coding for generate bar chart or pie chart using JSP
BMI by using JSP Languange
BMI by using JSP Languange  Using JSP language, create a system that calculates Body Mass Index (BMI) of users who entered their weight and height. Then, system will display all the records. Can you provide me the coding
BMI by using JSP Languange
BMI by using JSP Languange  Using JSP language, create a system that calculates Body Mass Index (BMI) of users who entered their weight and height. Then, system will display all the records. Can you provide me the coding
video uploading using jsp
video uploading using jsp  how to upload a videos in web page using jsp   Hi, You can upload your video with the help of JSP file upload code. Once file is upload you can play using any video player. Get the code
generate pdf using jsp
generate pdf using jsp  how do i generate a pdf using jsp that should query the data from the database and write it into a pdf and download the same
Jsp using mvc - JSP-Servlet
Jsp using mvc  hi I have written using mvc2 architecture, i have written logic in java ,i want to print a message on the form stating the the values are inserted successfully.So can you tell me how i have to write the code
jsp using netbeans
jsp using netbeans  Code to access and manage multiple e-mail accounts on the same page.. user should be able to edit mail accounts' link as required
barcode reader using jsp
barcode reader using jsp  HI ALL, I need jsp code for barcode reader.When we scan the barcode image that barcode value will be stored in one textbox automatically. please helpe me. Regards Bhanu
Tiemsheet using jsp
Tiemsheet using jsp  Hi, I am working on creating timesheet using JSP. Can you please help me on how to create a timesheet in excel using jsp and users should fill the excel sheet and then on submitting it should uplaod excel
sending mail using jsp
sending mail using jsp  please give me the detailed procedure and code for sending mail through jsp program   Please visit the following links: http://www.roseindia.net/ejb/introduction/j2eedemo.shtml http
Concept of subqueires using JSP
Concept of subqueires using JSP  Can I implement the concept of sub queries in JSP page , if yes please tell me how this can be achieved. I have requirement where output of the SQL query should be given as input to the update
display image using jsp
display image using jsp  display image using jsp and phonegap on emulator of eclipse   Here is a simple jsp code that displays an image on browser. <%@ page import="java.io.*" %> <%@page contentType="image/gif
emailing using jsp
emailing using jsp  hi there!! i have some difficulty in sending email using jsp. basically, i have an account table that retrieve all the account from the account-table in my ms sql database. so whenever i deleted the account
jsp using include & with mysql
jsp using include & with mysql  Sir, I am creating a login application using jsp & Mysql. The Codes are--- Html File...... <...; Jsp file....... <%@ page import="java.sql.*" %> <% String
jsp using Beans
jsp using Beans  public class Empbean { int empno; String ename... need jsp program for above bean class   Hi Friend, Try the following...); RequestDispatcher rd = req.getRequestDispatcher("/jsp/beandata.jsp"); rd.forward
jsp page authentication panel using jsp/servlet?
jsp page authentication panel using jsp/servlet?  I have 10 jsp jsp forms and 7 users and i want to grant variour permission like edit,delete and save for users dynamically on forms.So please refer me code
Uploading image using jsp
Uploading image using jsp  how to upload image using jsp. Already i... that image file ... I want know that solution using by u... Thanks, P.S.N.   Here is a jsp code that upload image and display it on the browser. 1
how to create using jsp
how to create using jsp  code 1: <%@ page language="java...;%=request.getContextPath()%>/jsp/Create.jsp">Create</a> </p> <p><a href="<%=request.getContextPath()%>/jsp/View.jsp">View </a>
file upload using JSP
file upload using JSP  I have created a form to upload a file in a html page, now i want to get the path of the file in a jsp page so what code should I write? thanks and regards...   1)page.jsp: <%@ page language
Displaying image using jsp and spring.
Displaying image using jsp and spring.  how to display an image stored in WEB-INF/images folder on the browser using jsp and spring
ajax using jsp
ajax using jsp  <%@ page import="java.io.*" %> <%@ page import="java.util.*" %> <%@ page import="java.sql.*" %> <%@ page import="java.util.StringTokenizer" %> <%@ page import="java.lang.*" %> <
create using jsp
create using jsp  code 1:``<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org
Ajax using jsp
Ajax using jsp  <%@ page import="java.io.*" %> <%@ page import="java.util.*" %> <%@ page import="java.sql.*" %> <%@ page import="java.util.StringTokenizer" %> <%@ page import="java.lang.*" %> <
video uploading using jsp
video uploading using jsp  this is the code i hv written for uploading..but the value in dropdown list is not captured..can any 1 tell the reason html file <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN
file uploading using jsp
file uploading using jsp  below file uploading code has one error "toBytes[i-start]=fromBytes; " incompatable type error please help me how to solve this error &lt;%@ page import="java.io.
upload image using JSP Hibernate
upload image using JSP Hibernate  sir, I want to take image from user and save to database(MYSQL) using Hibernate and JSP Thanks in advance
online shopping code using jsp
online shopping code using jsp  plz send me the code of online shopping using jsp or jdbc or servlets plz plz help me
update excel sheet using jsp::
update excel sheet using jsp::   Hi Sir,... I have a excel... given excel sheet and display it into another excel sheet using jsp" i am using 'session' to get the empid from one page to another jsp
Passing parameters in JSP using forward.
Passing parameters in JSP using forward.  If a page is forwarded to another page using jsp:forward, is it necessary that the page should be already............   Pass Parameters using jsp:forward
oracle database backup using jsp
oracle database backup using jsp   I want to take the backup of oracle database.I want to write the code in jsp ,so that when the page is loaded a backup of the database is stored in one of my local drives.Is it possible to do
edit values of database using jsp
edit values of database using jsp  hi i want a code to edit the row from tye database and display in a page which containd radio buttons and drop down boxes using jsp code
edit values of database using jsp
edit values of database using jsp  hi i want a code to edit the row from tye database and display in a page which containd radio buttons and drop down boxes using jsp code
Email to multiple recipients using jsp
Email to multiple recipients using jsp  Hi sir, Am a doing a project,in that i need to send email to multiple user at a time,the to address should enter manually its not not be written in code using jsp. Regards, Santhosh
Email to multiple recipients using jsp
Email to multiple recipients using jsp  Hi sir, Am a doing a project,in that i need to send email to multiple user at a time,the to address should enter manually its not not be written in code using jsp. Regards, Santhosh
database connectivity using jsp code
database connectivity using jsp code  i have two tables employee...),'bbbb','bbbb'); so this syntax is possible to use in jsp code based on employee id ename and designation are displayed how it is possible in jsp employee
draw a sine wave using jsp
draw a sine wave using jsp  hai frds.. i need to draw a sine wave by using jsp.. the values X and Y co-ordinate is present in database i have fetch those values from that then display the sine wave graph according
Uploading Multiple Files Using Jsp
Uploading Multiple Files Using Jsp  ... to understand how you can upload multiple files by using the Jsp. We should avoid... by using Jsp and how they will get stored on the particular memory area. To get
problem in jsp using ms-access
problem in jsp using ms-access  after starting server(tomcat) wen v...)Your DSN will get created. 6) Restart your server and run your jsp code. Here... will get created. 6) Restart your server and run your jsp code. Here is your
Pagination in jsp using oracle and not sql
Pagination in jsp using oracle and not sql  I need the code for pagination in jsp using oracle. I already tried it with rownum between instead of limit in sql.Please do forward me the code as soon as possible.   JSP
search functionality using jsp from database
search functionality using jsp from database  search functionality using jsp from database
Draw graph using jsp without database connection
Draw graph using jsp without database connection  Draw graph using jsp code without database connection
How to show database values into graph using jsp?
How to show database values into graph using jsp?  How to show database values into graph using jsp
how to upload and download images using buttons in jsp?
how to upload and download images using buttons in jsp?  how to upload and download images using buttons in jsp
How to upload files to server using JSP/Servlet?
How to upload files to server using JSP/Servlet?  How to upload files to server using JSP/Servlet
online test software using jsp and servlet
online test software using jsp and servlet  online test software using jsp and servlet
How to show database values into graph using jsp?
How to show database values into graph using jsp?  How to show database values into graph using jsp

Ads