Here is my table(in mysql) :
mysql> select device from user_management;
+--------+
| device |
+--------+
| APPLE |
| HTC |
| HTC |
| NOKIA |
| APPLE |
| APPLE |
+--------+
6 rows in set (0.00 sec)
Code I have is
<%
String query1 = "select device,count(device) from user_management where device='"+APPLE+"'";
JDBCCategoryDataset dataset = new JDBCCategoryDataset("jdbc:mysql://localhost:8080/apps","com.mysql.jdbc.Driver","root","root");
dataset.executeQuery(query1);
System.out.println("query1");
JFreeChart chart = ChartFactory.createBarChart3D("Device Statictics","Device","Count",dataset,PlotOrientation.VERTICAL,true,true,false);
try
{
ChartUtilities.saveChartAsJPEG(new File("D:/dvc.png"),chart,500,400);
}
catch(IOException e)
{
System.out.println(".....there is a problem in your chart. ");
}
%>
And on the basis of device name(APPLE,NOKIA,SAMSUNG) I want to create a bar chart which will show "no. of device VS device".
I want to show this in a jsp page.
Any inputs from yourside will be highly appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…