Home Backend Development PHP Tutorial Getting Started with phpexcel Graphics and Charts (1)_PHP Tutorial

Getting Started with phpexcel Graphics and Charts (1)_PHP Tutorial

Jul 13, 2016 am 10:37 AM
phpexcel graphics chart

PHPExcel - PHP processing engine for Excel

PHPExcel provides a series of PHP language classes, allowing you to easily read and write files in the following formats: .xls/.xlsx/.csv/.ods/Gnumeric/PDF/HTML...
Main functions include: setting file meta information, multiple worksheets, customized fonts and styles, borders and fills, pictures, calculation formulas, converting file types, etc.
Before, I only used to export data to Excel files in list format. The goal I need to achieve this time is: JSON->phpexcel->excel+chart(line/pie/etc...)
The outline of this series of articles "phpexcel graphs and charts" is as follows:
phpexcel graphs and charts (1) - Getting started----------------Introducing the PHPExcel class library and the basic steps for drawing
phpexcel graphics chart (2) - Graphics---------------- Take the most commonly used line/pie/bar/radar graphics as an example, and compare and analyze 4 types API
phpexcel graphics chart (3)-Advanced----------------Let the graphics beautify and complete some advanced effects
phpexcel graphics chart (3)-Advanced------------- Advanced functions related to charts that PHPExcel can complete
Original article, please indicate the source when reprinting: http://www.cnblogs.com/phpgcs
Summary of this article:
1. Download and study the PHPExcel repository
2. The difference between PHPExcel drawing and ordinary data processing
3. Summary of precautions
First of all, it is best to download the PHPExcel project locally to study
1
git clone git@github.com:PHPOffice/PHPExcel.git
Please read the README.md documentation carefully first, because it contains very important version information, especially the version range information for reading and writing Excel documents
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
### Reading
* BIFF 5-8 (.xls) Excel 95 and above
* Office Open XML (.xlsx) Excel 2007 and above
* SpreadsheetML (.xml) Excel 2003
* Open Document Format/OASIS (.ods)
* Gnumeric
* HTML
* SYLK
* CSV
### Writing
* BIFF 8 (.xls) Excel 95 and above
* Office Open XML (.xlsx) Excel 2007 and above
* HTML
* CSV
* PDF (using either the tcPDF, DomPDF or mPDF libraries, which need to be installed separately)
## Requirements
* PHP version 5.2.0 or higher
* PHP extension php_zip enabled (required if you need PHPExcel to handle .xlsx .ods or .gnumeric files)
* PHP extension php_xml enabled
* PHP extension php_gd2 enabled (optional, but required for exact column width autocalculation)
 
Enter the Examples folder, OhMygod, can complete so many functions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
01pharSimple.php
01simple-download-pdf.php
01simple-download-xls.php
01simple-download-xlsx.php
01simplePCLZip.php
01simple.php
02types.php
02types-xls.php
03formulas.php
04printing.php
05featuredemo.inc.php
05featuredemo.php
06largescale.php
06largescale-with-cellcaching.php
06largescale-with-cellcaching-sqlite3.php
06largescale-with-cellcaching-sqlite.php
06largescale-xls.php
07readerPCLZip.php
07reader.php
08conditionalformatting2.php
08conditionalformatting.php
09pagebreaks.php
10autofilter.php
10autofilter-selection-1.php
10autofilter-selection-2.php
10autofilter-selection-display.php
11documentsecurity.php
11documentsecurity-xls.php
12cellProtection.php
13calculation.php
14excel5.php
15datavalidation.php
15datavalidation-xls.php
16csv.php
17html.php
18extendedcalculation.php
19namedrange.php
20readexcel5.php
21pdf.php
22heavilyformatted.php
23sharedstyles.php
24readfilter.php
25inmemoryimage.php
26utf8.php
27imagesexcel5.php
28iterator.php
29advancedvaluebinder.php
30template.php
31docproperties_write.php
31docproperties_write-xls.php
32chartreadwrite.php
33chartcreate-area.php
33chartcreate-bar.php
33chartcreate-bar-stacked.php
33chartcreate-column-2.php
33chartcreate-column.php
33chartcreate-composite.php
33chartcreate-line.php
33chartcreate-multiple-charts.php
33chartcreate-pie.php
33chartcreate-radar.php
33chartcreate-scatter.php
33chartcreate-stock.php
34chartupdate.php
35chartrender.php
36chartreadwriteHTML.php
36chartreadwritePDF.php
37page_layout_view.php
38cloneWorksheet.php
40duplicateStyle.php
Excel2003XMLReader.php
Excel2003XMLTest.xml
.gitignore
GnumericReader.php
GnumericTest.gnumeric
images/
list
.~lock.33chartcreate-line.xlsx#
OOCalcReaderPCLZip.php
OOCalcReader.php
OOCalcTest.ods
Quadratic2.php
Quadratic.php
Quadratic.xlsx
runall.php
SylkReader.php
SylkTest.slk
templates/
XMLReader.php
XMLTest.xml
 
 
好吧,这次的任务是chart,就先从 line chart 入手,相关的文件只有一个 ***line.php
 
我们先直接运行一把:
 
1
2
3
4
5
6
liuyuan@ebuinfo:/var/www/projects/PHPExcel/Examples$ php 33chartcreate-line.php 
07:13:22 Write to Excel2007 format
07:13:23 File written to 33chartcreate-line.xlsx
07:13:23 Peak memory usage: 8.75 MB
07:13:23 Done writing file
File has been created in /var/www/projects/PHPExcel/Examples
  

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/735881.htmlTechArticlePHPExcel - Excel的PHP处理引擎 PHPExcel 提供了一系列的 PHP语言 类,让你可以轻松地读写操作以下格式的文件:.xls/.xlsx/.csv/.ods/Gnumeric/PDF/HTML... 主...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to add labels to legend in Google Sheet How to add labels to legend in Google Sheet Feb 19, 2024 am 11:03 AM

This article will demonstrate how to add labels to legends in Google Sheet that focus on a single thing, providing a name or identity. A legend explains a system or group of things, giving you relevant contextual information. How to Add Labels to a Legend in GoogleSheet Sometimes, when working with charts, we want to make them easier to understand. This can be achieved by adding appropriate labels and legends. Next, we’ll show you how to add labels to legends in Google Sheets to make your data clearer. Create the chart Edit the text of the legend label Let's get started. 1] Create a chart To label the legend, first, we have to create a chart: First, enter in the columns or rows of GoogleSheets

How to use PHP arrays to generate and display charts and statistical graphs How to use PHP arrays to generate and display charts and statistical graphs Jul 15, 2023 pm 12:24 PM

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

Implementation of linear and pie chart functions in Vue statistical charts Implementation of linear and pie chart functions in Vue statistical charts Aug 19, 2023 pm 06:13 PM

The linear and pie chart functions of Vue statistical charts are implemented in the field of data analysis and visualization. Statistical charts are a very commonly used tool. As a popular JavaScript framework, Vue provides convenient methods to implement various functions, including the display and interaction of statistical charts. This article will introduce how to use Vue to implement linear and pie chart functions, and provide corresponding code examples. Linear graph function implementation A linear graph is a type of chart used to display trends and changes in data. In Vue, we can use some excellent

Complete Guide: How to process Excel files using php extension PHPExcel Complete Guide: How to process Excel files using php extension PHPExcel Jul 28, 2023 pm 10:01 PM

Complete Guide: How to Process Excel Files Using PHP Extension PHPExcel Introduction: Excel files are often used as a common format for data storage and exchange when processing large amounts of data and statistical analysis. Using the PHP extension PHPExcel, we can easily read, write and modify Excel files to effectively process Excel data. This article will introduce how to use the PHP extension PHPExcel to process Excel files and provide code examples. 1. Install PHPExc

How to quickly build a statistical chart system under the Vue framework How to quickly build a statistical chart system under the Vue framework Aug 21, 2023 pm 05:48 PM

How to quickly build a statistical chart system under the Vue framework. In modern web applications, statistical charts are an essential component. As a popular front-end framework, Vue.js provides many convenient tools and components that can help us quickly build a statistical chart system. This article will introduce how to use the Vue framework and some plug-ins to build a simple statistical chart system. First, we need to prepare a Vue.js development environment, including installing Vue scaffolding and some related plug-ins. Execute the following command in the command line

Learning Excel Charts: How to Make Charts Move Like Web Pages Learning Excel Charts: How to Make Charts Move Like Web Pages Aug 16, 2022 am 10:30 AM

In the previous article "Excel chart learning through cases, let's talk about how to draw a graduated cylinder column chart", we learned about the method of drawing a graduated cylinder column chart. Today we will share another Excel chart tutorial and talk about a method to make Excel charts move like a web page. As long as you enter keywords, the table data and charts will automatically change. Especially when the company's data needs to be divided into departments, it is simply too confusing. Convenient!

PHP development: Use PHPExcel to process Excel files PHP development: Use PHPExcel to process Excel files Jun 15, 2023 pm 03:45 PM

With the advent of the digital age, data has become the most important part of our daily lives and work, and Excel files have become one of the important tools for data processing. I believe that many PHP developers will often encounter the use of Excel files for data processing and operations at work. This article will introduce you to the methods and precautions for using the PHPExcel library to process Excel files. What is PHPExcel? PHPExcel is a PHP class

How to use PHP and Vue.js to implement data filtering and sorting functions on charts How to use PHP and Vue.js to implement data filtering and sorting functions on charts Aug 27, 2023 am 11:51 AM

How to use PHP and Vue.js to implement data filtering and sorting functions on charts. In web development, charts are a very common way of displaying data. Using PHP and Vue.js, you can easily implement data filtering and sorting functions on charts, allowing users to customize the viewing of data on charts, improving data visualization and user experience. First, we need to prepare a set of data for the chart to use. Suppose we have a data table that contains three columns: name, age, and grades. The data is as follows: Name, Age, Grades Zhang San 1890 Li

See all articles