php生成图表_使用PHP组件的4种最佳图表生成选项

php生成图表

Data is everywhere around us, but it is boring to deal with raw data alone. That’s where visualization comes into the picture.

数据无处不在,但仅处理原始数据很无聊。 这就是可视化进入图片的地方。

alt

If you take a look at the Google Trends plot below, you will realize that interest in Data Visualization has seen a steady growth over the years.

如果您查看下面Google趋势图 ,您将意识到多年来对数据可视化的兴趣一直在稳定增长。

So, if you are dealing with data and are not already using some kind of charting component, there is a good chance that you are going to need one soon. That’s the reason I decided to make a list of libraries that will make the task of visualizing data easier for you.

因此,如果您正在处理数据并且尚未使用某种图表组件,则很有可能很快就会需要一个图表组件。 这就是我决定列出一个库列表的原因,该列表将使您更轻松地可视化数据。

But before we get started, you need to understand that there are two types of charting components: server side and client side. Both have their pros and cons, and what’s best for you completely depends on the objective of your project and the resources you have. I’ve covered client side charts in this post, but there is some overlap as you’ll see below.

但是在开始之前,您需要了解图表组件有两种类型:服务器端和客户端。 两者都有其优点和缺点,什么对您来说最好完全取决于您的项目目标和所拥有的资源。 我已经在这篇文章中介绍了客户端图表,但是您会在下面看到一些重叠。

服务器端与客户端图表生成 (Server Side vs Client Side Chart Generation)

Server side components usually generate image charts. They employ algorithms to convert data into chart images and increase server overhead. Apart from using the server’s processing power, image based charts increase the bandwidth consumption. Sometimes large image sizes lead to slow downloads, which might be annoying to end users.

服务器端组件通常会生成图像图表。 他们采用算法将数据转换为图表图像并增加服务器开销。 除了使用服务器的处理能力之外,基于图像的图表还会增加带宽消耗。 有时,大尺寸图片会导致下载缓慢,这可能会给最终用户带来烦恼。

The above limitations of server side charts can be overcome by using client side components (JavaScript based). A browser will fetch the JSON or XML data from the server and render the charts locally. Client side components also have a greater scope of customization. They are often interactive, support animation and can easily blend into the design of your application.

服务器端图表的上述限制可以通过使用客户端组件(基于JavaScript)来克服。 浏览器将从服务器获取JSON或XML数据,并在本地呈现图表。 客户端组件也具有更大的定制范围。 它们通常是交互式的,支持动画,并且可以轻松地融入您的应用程序设计中。

Some charting libraries (like FusionCharts) provide wrappers which allow you to write your code in PHP only. Using the PHP wrapper you can generate the required JavaScript and HTML code as a string on the server. You can then output these strings in the page to generate charts.

一些图表库(例如FusionCharts)提供了包装程序,使您仅可以用PHP编写代码。 使用PHP包装程序,您可以在服务器上生成所需JavaScript和HTML代码作为字符串。 然后,您可以在页面中输出这些字符串以生成图表。

With this in mind, let’s go through some options for charting that have PHP components.

考虑到这一点,让我们看一下具有PHP组件的图表选项。

Google图表(客户端) (Google Charts (Client Side))

Although it is JavaScript based, Google Charts has a couple of options to make your charts entirely in PHP. You can either use server-side code (in our case PHP) to get the data, or get one of the open-source wrappers to do it for you.

尽管它是基于JavaScript的,但是Google Charts有两个选项可以使您的图表完全使用PHP。 您可以使用服务器端代码 (在我们的示例中为PHP)来获取数据,也可以使用一种

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值