JFreeChart use to create web-based chart

  http://www.jfree.org/jfreechart/index.html 
  JFreeChart download page: http://sourceforge.net/projects/jfreechart/ 

  Download time is necessary to pay attention to the need to download two documents: JFreeChart and Jcommon.    Supporting the latest version is: JFreeChart 0.9.11 Jcommon 0.8.6 

  Here the author in the development of some problems that need to be met to note: the use of the Eclipse development will be reported when a baffling error, error may point to a certain category of the first line.    Encountered this kind of problem is generally not Jcommon because of the jar to set up packages of projects in the path of reason.    Specific reasons ominous. 

    Onclick = "javascript: clickChart ('100 '); return false;"> 
  <AREA SHAPE = "RECT" COORDS = "143,27188255" href = "? Series = 0 & category = 200" title = "200 = 6721" 
  Onclick = "javascript: clickChart ('200 '); return false;"> 
  <AREA SHAPE = "RECT" COORDS = "205,54250255" href = "? Series = 0 & category = 300" title = "300 = 5929" 
  Onclick = "javascript: clickChart ('300 '); return false;"> 
  <AREA SHAPE = "RECT" COORDS = "267,85312255" href = "? Series = 0 & category = 400" title = "400 = 5005" 
  Onclick = "javascript: clickChart ('400 '); return false;"> 
  <AREA SHAPE = "RECT" COORDS = "329,17374255" href = "? Series = 0 & category = Diet" title = "Diet = 7017" onclick = "javascript: 
  ClickChart ( 'Diet'); return false; "> 
  </ MAP> 

  Thus creating a question: If the image to generate a corresponding MAP object.    We just look at the code, 

  Object creation of a chart when there are two parameters, and we cited the example histogram parameters of these two terms is ChartFactory. 

  CreateBarChart3D way in the last two parameters, the parameters of these two types are boolean value.    This means two parameters are: 

  Has created tooltips (tooltip), and whether generated URL.    These two parameters corresponding to a AREA MAP in the title attribute and 

  Href attribute. 

  But I would like to know is how to generate the MAP ah!    Hey, not to worry, JFreeChart has helped us do a good job of generating MAP 

  Like functions.    To generate MAP object to the introduction of another object: ChartRenderingInfo.    Because there is no direct JFreeChart 

  Methods Using a chart object directly MAP generated data, it needs an intermediate object to the transition, and this object is 

  ChartRenderingInfo.    The chart is generated MAP data flow chart: 

  Figure 7 

  As shown below, ChartUtilities category is the core of the entire process, it is the target of some peripheral such as data objects or documents. 

  This simple process described as follows: First, the creation of a ChartRenderingInfo object and the calling ChartUtilities writeChartAsJPEG 

  As a parameter when the final transfer into.    Calling the end of this method will produce an image file, as well as a good filler MAP data 

  ChartRenderingInfo object, this object we still have no way of obtaining specific MAP data, we must also help 

  ChartUtilities writeImageMap approach to the ChartRenderingInfo object will be read out, access to the MAP data such as code snippet 

  Under: 

  PrintWriter w = null; 
  FileOutputStream fos_jpg = null; 
  FileOutputStream fos_cri = null; 
  Try ( 
  / / In accordance with the different types of use of different types of charts, the following is the operation against Bingtu 
  PiePlot plot = (PiePlot) chart.getPlot (); 
  Plot.setURLGenerator (new StandardPieURLGenerator (url)); 
  / / Set-up tool tips 
  Plot.setToolTipGenerator (new StandardPieToolTipGenerator ()); 
  Fos_jpg = new FileOutputStream ( "d: \ \ fruit.jpg"); 
  ChartUtilities.writeChartAsJPEG ( 
  Fos_jpg, 
100,
  Chart, 
400,
300,
  Info); 
  Fos_cri = new FileOutputStream (__d: \ \ fruit.map__); 
  W = new PrintWriter (fos_cri); 
  ChartUtilities.writeImageMap (w, __mapname__, info); 
  W.flush (); 
  Finally () 
  Try ( 
  W.close (); 
  ) Catch (Exception e) () 
  Try ( 
  Fos_cri.close (); 
  ) Catch (Exception e) () 
  Try ( 
  Fos_jpg.close (); 
  ) Catch (Exception e) () 
  ) 
  Open the file D: \ fruit.map, the contents of the documents is to write on the page MAP data.    The generated image data, documents, as well as MAP 

  Wrote on the pages of hot spots can be completed chart function.    As for how a combination of the two images such as the relationship between the attribute value must be useMap 

  And the MAP combined with the name, must be based on the actual application of the corresponding address.    I propose the adoption of the two labels 

  The package, the image file name and the name of the MAP tag library unified control, which would guarantee them a 

  To the sexual. 

Bookmark it: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Google
  • DotNetKicks
  • DZone
  • Furl
  • Netvouz

Releated Articles

  • Popuklar Articles

0 Comments to “JFreeChart use to create web-based chart”

No Comments. Send your comment.

Leave a Reply

You must be logged in to post a comment.