基于 Javascript 的绘图/图表工具包与基于 PHP 的工具包

发布于 2024-11-28 17:37:01 字数 402 浏览 1 评论 0原文

我正在考虑使用 http://pchart.sourceforge.net/ 来满足我们的图形/图表要求,但另一位开发人员建议使用基于 javascript/jquery 的工具,例如 - http://dojotoolkit.org/

感觉两者都是不同,也许基于 javascript 的解决方案更容易操作 - 我不相信这会是更快的解决方案。

对于最终用户来说,基于 PHP 的工具包是否会更快,并且服务器和客户端计算机之间来回的数据更少?

我们的图表要求是出于报告目的 - 我们根本不要求用户“实时”操作图表。

I'm contemplating using http://pchart.sourceforge.net/ for our graphing / charting requirements but another developer suggested the use of a javascript/jquery based one like - http://dojotoolkit.org/

While the look-n-feel for both are different, and perhaps a javascript based one is more easily manipulatable - I'm not convinced it would be the faster solution.

Wouldnt a PHP based toolkit be faster anyday, for the end user, with less data going back and forth between our server and the client machine?

Our charting requirements are for reporting purposes - we dont require users to manipulate the charts 'live' at all.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

迷你仙 2024-12-05 17:37:01

在不考虑表现方面的情况下,这两种方法通常各有优缺点,其中一个优点就是另一个缺点。

PHP 方法:

  • 可以说结果更加一致。
  • 如果输入的数据不变,则可以保存结果图表,
    这将避免同一进程多次运行,
    从而获得更好的整体性能。

Javascript 方法:

  • 服务器上需要的计算能力更少。
  • 可以动态生成结果图表,提供更多信息
    交互式用户体验。

Without considering presentation aspects, the 2 approaches generally have their pros and cons, whereas one's pro being the other's con.

The PHP approach:

  • arguably more consistent results.
  • resulting chart(s) could be saved if data is constant once entered,
    this would avoid having the same process run multiple times,
    resulting better overall performance.

The Javascript approach:

  • less computing power needed on the server.
  • resulting chart(s) could be generated dynamically delivering a more
    interactive user experience.
灼疼热情 2024-12-05 17:37:01

我相信,如果视图是在客户端完成的,则意味着服务器上的处理会减少。所以我相信客户端图形/图表会更好(使用javascript)

I believe if the view is done at the client side it means less processing at the server. So i believe that client side graphing/charting would be better (using javascript)

灰色世界里的红玫瑰 2024-12-05 17:37:01

要求您说明 pHP 似乎是一种更好的方法。就像您已经提到的,如果您的图表是静态的并且您没有将数据发送到客户端,那么在 js 中渲染图表是没有意义的。您的 php 服务器总有一天会超越浏览器渲染速度,因为那时您依赖于使用市场上最新浏览器的客户端,并且它们在客户端有足够的内存来执行相同的操作。

为什么你的队友会想到 JS 方法。他也有同样的理由吗?

with the requirement that you have stated the pHP one seems like a batter approach. Like you already mentioned if your chart is static and you are not sending over the data to the client side then it doesnt make sense to render the chart in js. Your php server will any day outperform the browser rendering speed as then your dependent on the client using the latest browsers in the market and they have adequate memory on client side to do the same.

Why is your teammate thinking of the JS approach. Does he have a reason for the same?

骑趴 2024-12-05 17:37:01

我最近发现了 jqPlot 并在一个公司项目中使用了它,这让我的老板很高兴。 PHP 解决方案不会为您提供像 Javascript 那样动态的解决方案。此外,PHP 图形方法有时体积庞大并且需要更多代码。

一旦Javascript代码被下载到客户端的机器上,它就会被缓存以供进一步的请求,因此只下载图的初始化代码(几个字节+系列数据),这导致发送的字节更少,从而降低带宽消耗。

至于报告数据,使用缓存机制可能是最好的解决方案,因为您可以将报告数据重复用于不同的视图(可下载为 CSV 等)。

总而言之,我个人通常更喜欢保留服务器端的数据处理,并且视图表示的客户端处理。

I have recently found jqPlot and used it in a corporate project to my boss' delight. A PHP solution will not give you a solution as dynamic as a Javascript one. Moreover, PHP graph approach are sometimes bulky and require more code.

Once the Javascript code is downloaded unto the client's machine, it is cached for further requests, so only the graph's initialization code is downloaded (a few bytes + the series data), this results in fewer bytes being sent, thus a lower bandwidth consumption.

As for the report data, using caching mechanisms is probably the best solution as you can reuse the report data for different views (downloadable as CSV, etc.)

All and all, I personally usually prefer to keep the server side processing for data, and client side processing for the view representation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文