Click here to Skip to main content
15,893,904 members
Home / Discussions / Java
   

Java

 
AnswerRe: creating a class with coding_?. Pin
Richard MacCutchan11-Aug-11 5:59
mveRichard MacCutchan11-Aug-11 5:59 
GeneralRe: creating a class with coding_?. Pin
quartaela11-Aug-11 6:07
quartaela11-Aug-11 6:07 
AnswerRe: creating a class with coding_?. Pin
jschell11-Aug-11 13:13
jschell11-Aug-11 13:13 
GeneralRe: creating a class with coding_?. Pin
quartaela12-Aug-11 12:43
quartaela12-Aug-11 12:43 
GeneralRe: creating a class with coding_?. Pin
quartaela12-Aug-11 12:44
quartaela12-Aug-11 12:44 
AnswerRe: creating a class with coding_?. Pin
David Skelly11-Aug-11 22:17
David Skelly11-Aug-11 22:17 
GeneralRe: creating a class with coding_?. Pin
quartaela13-Aug-11 3:32
quartaela13-Aug-11 3:32 
QuestionJfreechart with jsp and servlet giving error Pin
cmaheshwari1611-Aug-11 0:13
cmaheshwari1611-Aug-11 0:13 
Hi All,

I am using JSP and servlet technology for making graphs.

Below please find my jsps,

Display.jsp


Java
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<%@ page  import="java.awt.*" %>
<%@ page  import="java.io.*" %>
<%@ page  import="org.jfree.chart.*" %>
<%@ page  import="org.jfree.chart.axis.*" %>
<%@ page  import="org.jfree.chart.entity.*" %>
<%@ page  import="org.jfree.chart.labels.*" %>
<%@ page  import="org.jfree.chart.plot.*" %>
<%@ page  import="org.jfree.chart.renderer.CategoryItemRenderer" %>
<%@ page  import="org.jfree.chart.urls.*" %>
<%@ page  import="org.jfree.data.*" %>
<%@ page  import="org.jfree.data.CategoryDataset" %>

<%
  final double[][] data = new double[][]{{210, 300, 320, 265, 299},{200, 304, 201, 201, 340}};

 final CategoryDataset dataset = DatasetUtilities.createCategoryDataset("Team ", "", data);

 final JFreeChart chart = ChartFactory.createAreaChart("Area Chart", "", "Value", dataset, PlotOrientation.VERTICAL,true, true, false);
 
 final CategoryPlot plot = chart.getCategoryPlot();
 plot.setForegroundAlpha(0.5f);

 chart.setBackgroundPaint(new Color(249, 231, 236));

 try {
  final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());

  //String sname = request.getRealPath("/");
	
	
	//sname = sname.concat("web/areachart.png");
	//out.println(sname);
	//file = new File(sname);
  
 //final File file1 = new File(sname);
 File file1 = new File("../webapps/jspGraphFunction/web/areachart.png");

 ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info);
  } catch (Exception e) {
  out.println(e);
  }

%>

<html>
  <head>
  <meta http-equiv="Content-Type" 
   content="text/html; charset=UTF-8">
  <title>JSP Page</title>
  </head>
  <body>
  <!-- <IMG SRC="areachart.png" WIDTH="600" HEIGHT="400" BORDER="0" 
   USEMAP="#chart">-->
   <IMG SRC="web/areachart.png" WIDTH="600" HEIGHT="400" BORDER="0" 
   USEMAP="#chart">
  </body>
</html> 



Now its giving the below error for the bolded statement in the code:

Quote:
The method createAreaChart(String, String, String, CategoryDataset, PlotOrientation,
boolean, boolean, boolean) in the type ChartFactory is not applicable for the arguments
(String, String, String, CategoryDataset, PlotOrientation, boolean, boolean, boolean)


On net only this way of using the jfreechart is given

I have included the two jars Jfreechart... and jcommon in my lib folder.


Pls suggest,

Chandan
AnswerRe: Jfreechart with jsp and servlet giving error Pin
Gerben Jongerius11-Aug-11 20:22
Gerben Jongerius11-Aug-11 20:22 
GeneralRe: Jfreechart with jsp and servlet giving error Pin
cmaheshwari1611-Aug-11 23:03
cmaheshwari1611-Aug-11 23:03 
QuestionJAAS Question Pin
AndreFratelli10-Aug-11 9:12
AndreFratelli10-Aug-11 9:12 
QuestionExecute commands in putty prompt through java Pin
kartikdasani10-Aug-11 4:13
kartikdasani10-Aug-11 4:13 
AnswerRe: Execute commands in putty prompt through java Pin
Nagy Vilmos10-Aug-11 5:25
professionalNagy Vilmos10-Aug-11 5:25 
AnswerRe: Execute commands in putty prompt through java Pin
David Skelly10-Aug-11 22:24
David Skelly10-Aug-11 22:24 
QuestionHow to use jFreechart in struts2 Pin
cmaheshwari169-Aug-11 19:24
cmaheshwari169-Aug-11 19:24 
AnswerRe: How to use jFreechart in struts2 Pin
cmaheshwari1611-Aug-11 0:01
cmaheshwari1611-Aug-11 0:01 
QuestionCheck if a program is installed on Linux or Mac Pin
CodeGust8-Aug-11 16:59
CodeGust8-Aug-11 16:59 
AnswerRe: Check if a program is installed on Linux or Mac Pin
Richard MacCutchan8-Aug-11 21:29
mveRichard MacCutchan8-Aug-11 21:29 
AnswerRe: Check if a program is installed on Linux or Mac Pin
jschell10-Aug-11 9:48
jschell10-Aug-11 9:48 
GeneralRe: Check if a program is installed on Linux or Mac Pin
David Skelly10-Aug-11 22:16
David Skelly10-Aug-11 22:16 
GeneralRe: Check if a program is installed on Linux or Mac Pin
jschell11-Aug-11 12:53
jschell11-Aug-11 12:53 
GeneralRe: Check if a program is installed on Linux or Mac Pin
David Skelly11-Aug-11 22:07
David Skelly11-Aug-11 22:07 
Questionajax popup Pin
sundarkarthi5-Aug-11 2:19
sundarkarthi5-Aug-11 2:19 
AnswerRe: ajax popup Pin
TorstenH.5-Aug-11 2:51
TorstenH.5-Aug-11 2:51 
Questionare there any functions in java like ispunct, isspace in C_? Pin
quartaela4-Aug-11 1:54
quartaela4-Aug-11 1:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.