


How to display statistical charts drawn by JFreechart on PHP_PHP Tutorial
How to display JFreechart on PHP? Most people may encounter this situation. The servlet on JSP can completely display the statistical chart drawn by JFreechart, but it cannot be displayed when mixed with other languages
Me I also encountered this problem now. After thinking about it for half an hour, I finally figured it out. The implementation process is still very simple. (Just a summary of personal experience)
Solution ideas:
1. First save the images generated by JFreechart on the web server.
2. Then use the tag to display on the JSP
3. Import the JSP into the PHP page through JS
This is achieved.
Part of the getColumnChart.jsp source code:
<%
String startTime = request.getParameter("startTime");
String endTime = request.getParameter("endTime");
String filter = request.getParameter("filter");
Charts charts = new Charts();
String start = startTime == null ? "2013-05-12" : startTime;
String end = endTime == null ? "2013-11-01" : endTime ;
String filters = filter == null ? "eventtype" : filter;
JFreeChart chart = charts
.getPieChart(startTime, endTime, filter);//Start time, end time, filter
String filename = ServletUtilities.saveChartAsJPEG(chart, 800, 400,
null, session);
FileOutputStream fos_jpg = null;
File file = new File(application.getRealPath("")+"/charts" );
String path =request.getContextPath()+"/charts/NoData.jpg";
try {
file.mkdirs();
fos_jpg = new FileOutputStream(file.getPath() +"/"+filename);
ChartUtilities.writeChartAsJPEG(fos_jpg, 1.0f, chart, 800, 400,
null);
} catch (Exception e) {
} finally {
try {
fos_jpg.close();
} catch (Exception e) {
}
}
path = request.getContextPath()+"/charts/"+filename;
%>
JS source code to import JSP
extjs.chart.chart3D = function(nodeid,id){
var panel = new Ext.Panel({
border:false,
fitToFrame: true ,//It’s very simple, just an Html tag
html: ''
});
return panel;
}

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











ECharts and Java interface: How to quickly implement statistical charts such as line charts, bar charts, and pie charts. Specific code examples are required. With the advent of the Internet era, data analysis has become more and more important. Statistical charts are a very intuitive and powerful display method. Charts can display data more clearly, allowing people to better understand the connotation and patterns of the data. In Java development, we can use ECharts and Java interfaces to quickly display various statistical charts. ECharts is a software developed by Baidu

How to use PHP arrays to generate and display charts and statistical graphs. PHP is a widely used server-side scripting language with powerful data processing and graphic generation capabilities. In web development, we often need to display charts and statistical graphs of data. Through PHP arrays, we can easily implement these functions. This article will introduce how to use PHP arrays to generate and display charts and statistical graphs, and provide relevant code examples. Introducing the necessary library files and style sheets Before starting, we need to introduce some necessary library files into the PHP file

ECharts and Java Interface: A Getting Started Guide to Implementing Various Types of Statistical Charts Introduction: With the widespread application of data visualization in various industries and fields, various chart libraries have also developed rapidly. ECharts is a powerful open source visualization library developed and maintained by Baidu. It has rich chart types and flexible customization capabilities. This article will introduce how to use ECharts through the Java interface to implement various types of statistical charts. Preparation Before starting, we need to ensure that the Java development environment has been installed.

How to use ECharts and PHP interfaces to generate statistical charts Introduction: In modern web application development, data visualization is a very important link, which can help us display and analyze data intuitively. ECharts is a powerful open source JavaScript chart library. It provides a variety of chart types and rich interactive functions, and can easily generate various statistical charts. This article will introduce how to use ECharts and PHP interfaces to generate statistical charts, and give specific code examples. 1. Overview of ECha

How to use the Vue statistical chart plug-in and examples Introduction: When developing web applications, statistical charts are very useful data visualization tools. Vue.js is a popular JavaScript framework that provides many convenient plugins and tools for creating interactive statistical charts. This article will introduce how to use the statistical chart plug-in using Vue.js and provide some code examples. 1. Install the Vue statistical chart plug-in. Before starting, we need to make sure that Vue.js has been installed. Then we can make

How to combine ECharts and PHP interfaces to implement dynamic updates of statistical charts Introduction: Data visualization plays a vital role in modern applications. ECharts is an excellent JavaScript chart library that can help us easily create various types of statistical charts. PHP is a scripting language widely used in server-side development. By combining ECharts and PHP interfaces, we can realize dynamic updating of statistical charts, so that charts can be automatically updated according to changes in real-time data. Book

Introduction to how to combine ECharts and PHP interfaces to realize dynamic data display of statistical charts: With the development of Internet technology, data visualization plays an important role in various fields. ECharts is a powerful data visualization library that can help us quickly create various types of charts. PHP is a popular server-side scripting language that can be used to handle data requests and build interfaces. Combining ECharts and PHP interfaces, we can realize dynamic data display of statistical charts and easily implement charts.

How to use ECharts and PHP interfaces to generate statistical charts with labels and legends. With the development of Internet technology, data visualization has become an increasingly important task. As an intuitive and easy-to-understand display method, statistical charts are widely used in data analysis and decision support. As an excellent open source chart library, ECharts provides a wealth of data visualization chart types and powerful functions, and has become the first choice of many developers and data analysts. This article will introduce how to use ECharts and php interface
