c-pchart

A project bringing Composer support and PSR standards to pChart 2.0 library.

  • 所有者: szymach/c-pchart
  • 平台:
  • 许可证: GNU General Public License v3.0
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Table of contents:

Support:

This project is supported in a basic manner and no new features will be introduced.
Issues and pull requests will be reviewed and resolved if need be, so feel free
to post them.

Build status:

  • Build Status master
  • Build Status 2.0

Code quality:

Scrutinizer Code Quality
Code Coverage

About:

This library is a port of the excellent pChart statistics library created by Jean-Damien Pogolotti,
and aims to allow the usage of it in modern applications. This was done through
applying PSR standards to code, introducing namespaces and typehints, along with
some basic annotations to methods.

This is the 3.x version, which removes the factory service and reorganizes the
file structure a bit. It does not introduce any new features, but the changes are
not compatibile with the 2.x branch. BC compatibility with the original library
is mostly retained, however you can still use the 1.x version if you cannot risk
any of these.

What was done:

  • Support for PHP versions from 5.4 to 7.3.

  • Made a full port of the library's functionality. I have touched very little of
    the actual logic, so most code from the original library should work.

  • Defined and added namespaces to all classes.

  • Replaced all exit() / die() commands with throw statements.

  • Refactored the code to meet PSR-2 standard and added annotations (as best as I could figure them out)
    to methods Also, typehinting was added to methods where possible, so some backwards compatibility breaks
    may occur if you did some weird things.

  • Moved all constants to a single file. It is loaded automatically
    through Composer, so no need for manual action.

License:

It was previously stated that this package uses the MIT license,
which did not meet the requirements set by the original author. It is now under the
GNU GPL v3 license, so if you wish to
use it in a commercial project, you need to pay an appropriate fee.

Contributing:

All in all, this is a legacy library ported over from PHP 4, so the code is neither
beautiful nor easy to understand. I did my best to modernize and cover it with
some basic tests, but there is much more that could be done. If you are willing and
have time to fix or improve anything, feel free to post a PR or issue.

Installation (via Composer):

For composer installation, add:

"require": {
    "szymach/c-pchart": "^3.0"
},

to your composer.json file and update your dependencies. Or you can run:

$ composer require szymach/c-pchart

in your project's root directory.

Usage:

Your best source to understanding how to use the library is still the official wiki.
However, I have ported at least one example for each chart into Markdown files,
so you can compare each version and figure out how to use the current implementation.

Charts created through Image class

Most of the basic charts are created through methods of the CpChart\Image
class. Below you can find a full list of these charts, alongside example code.

Standalone charts:

The more advanced charts have their own separate class you need to use in order
to create them. As before, below is a full list of these, with example code.

Barcodes

The pChart library also provides a way to render barcodes 39 and 128. Below you
can find links to doc on creating them:

Cache

If you find yourself creating charts out of a set of data more than once, you may
consider using the cache component of the library. Head on to the dedicated part
of the documentation for information on how to do that.

Fonts and palletes

If you want to use any of the fonts or palletes files, provide only
the name of the actual file, do not add the fonts or palettes folder to the
string given into the function. If you want to load them from a different directory
than the default, you need to add the full path to the file (ex. __DIR__.'/folder/to/my/palletes).

References

The original pChart website

Links

GitHub

Packagist

主要指标

概览
名称与所有者szymach/c-pchart
主编程语言PHP
编程语言PHP (语言数: 2)
平台
许可证GNU General Public License v3.0
所有者活动
创建于2014-04-19 17:36:10
推送于2023-06-19 07:59:16
最后一次提交
发布数37
最新版本名称v3.0.17 (发布于 )
第一版名称1.1.1 (发布于 )
用户参与
星数143
关注者数6
派生数47
提交数268
已启用问题?
问题数36
打开的问题数8
拉请求数43
打开的拉请求数0
关闭的拉请求数15
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?