Interpretation of JFreeChart's source structure (link)

xiaoxiao2021-03-06  57

We must first understand the structure of JFreeChart itself and some examples thereof, which helps us to develop by our next step by prior to the structure of jfreechart itself. Downloading the JFreeChart package has already had a very rich example, because JFreeChart this project itself is very small, so learning it is the best way to learn the example source code it belongs. There are dozens of files in the package org.jfree.chart.demo to show all the results of all charts that JFreeChart can support. If your JDK is more new, there will be problems when running these examples, and the phenomenon is as follows:

Java.lang.unsatisfiedlinkerror: initddraw

At sun.awt.windows.win32offscreensurfacedata.initdDraw (Native Method)

At sun.awt.windows.win32offscreensurfacedata.

(Win32OffscreensurfaceData.java: 141)

At sun.awt.win32graphicsdevice.

(Win32GraphicsDevice.java: 58)

At sun.awt.win32graphicsenvironment.com (Win32Graphicsenvironment (Win32Graphicsenvironment ).java: 168)

At sun.java2d.sungraphicsenvironment.getscreenDevices (Sungraphicsenvironment.java:240) (SUNGRAPHICSENVIRONMENT.JAVA:

At sun.awt.win32graphicsenvironment.getdefaultscreenDevice (Win32Graphicsenvironment.java: 61)

At java.awt.window.init (window.java: 224)

At java.awt.window.

(Window.java: 268)

AT java.awt.frame.

(Frame.java: 398)

AT javax.swing.jframe.

(Jframe.java: 198) at Org.jfree.Chart.demo.jfreechartDemo.

(Jfreechartdemo.java:148) at Org.jfree.Chart.demo.jfreechartDemo.main (jfreechartdemo.java: 285) Exception in thread "main"

This error is due to the new version of Swing's large number of technologies that use Microsoft DirectDraw technology to improve the performance of the drawing, and you may have a technique that you will not support you at this time. Is there any way? It is also very simple to solve this problem. We can block DirectDraw, and you can use this technology without swing. Specify parameters to the virtual machine when running these code - DSun.java2d.noddraw.

At this time, you may be wondering again, don't say it is a web-based chart, how can I pull Swing? This is because the developers are easy to get started without configuring any operating environment, so these examples are based on the GUI mode for display to the developer if they have to generate a chart, how do we learn how to use this engine to generate a chart instead of How to display a chart. When we use the generated chart object export to an image file to be released on the web.

转载请注明原文地址:https://www.9cbs.com/read-117865.html

New Post(0)