cache
2 years ago
resources
4 years ago
src
1 year ago
LICENSE
6 years ago
README.md
3 years ago
constants.php
2 years ago
README.md
186 lines
| 1 | Table of contents: |
| 2 | ================== |
| 3 | * [](#supportSupport](#support](#support) |
| 4 | * [](#build-statusBuild status](#build-status](#build-status) |
| 5 | * [](#code-qualityCode quality](#code-quality](#code-quality) |
| 6 | * [](#aboutAbout](#about](#about) |
| 7 | * [](#licenseLicense](#license](#license) |
| 8 | * [](#contributingContributing](#contributing](#contributing) |
| 9 | * [](#installation-via-composerInstallation](#installation-via-composer](#installation-via-composer) |
| 10 | * [](#usageUsage](#usage](#usage) |
| 11 | - [](#charts-created-through-image-classCharts created through Image class](#charts-created-through-image-class](#charts-created-through-image-class) |
| 12 | - [](#standalone-chartsStandalone charts](#standalone-charts](#standalone-charts) |
| 13 | - [](#barcodesBarcodes](#barcodes](#barcodes) |
| 14 | - [](#cacheCache](#cache](#cache) |
| 15 | - [](#fonts-and-palletesFonts and palletes](#fonts-and-palletes](#fonts-and-palletes) |
| 16 | * [](#changelogChangelog](#changelog](#changelog) |
| 17 | * [](#referencesReferences](#references](#references) |
| 18 | * [](#linksLinks](#links](#links) |
| 19 | |
| 20 | Support: |
| 21 | ======== |
| 22 | |
| 23 | This project is supported in a basic manner and no new features will be introduced. |
| 24 | Issues and pull requests will be reviewed and resolved if need be, so feel free |
| 25 | to post them. |
| 26 | |
| 27 | Build status: |
| 28 | ============= |
| 29 | - [](https://app.travis-ci.com/szymach/c-pchart](https://app.travis-ci.com/szymach/c-pchart](https://app.travis-ci.com/szymach/c-pchart) master |
| 30 | - [](https://app.travis-ci.com/szymach/c-pchart](https://app.travis-ci.com/szymach/c-pchart](https://app.travis-ci.com/szymach/c-pchart) 3.0 |
| 31 | - [](https://app.travis-ci.com/szymach/c-pchart](https://app.travis-ci.com/szymach/c-pchart](https://app.travis-ci.com/szymach/c-pchart) 2.0 |
| 32 | |
| 33 | About: |
| 34 | ====== |
| 35 | |
| 36 | This library is a port of the excellent pChart statistics library created by Jean-Damien Pogolotti, |
| 37 | and aims to allow the usage of it in modern applications. This was done through |
| 38 | applying PSR standards to code, introducing namespaces and typehints, along with |
| 39 | some basic annotations to methods. |
| 40 | |
| 41 | This is the `3.x` version, which removes the factory service and reorganizes the |
| 42 | file structure a bit. It does not introduce any new features, but the changes are |
| 43 | not compatibile with the `2.x` branch. BC compatibility with the original library |
| 44 | is mostly retained, however you can still use the `1.x` version if you cannot risk |
| 45 | any of these. |
| 46 | |
| 47 | What was done: |
| 48 | |
| 49 | - Support for PHP versions from 5.4 to 8.1. |
| 50 | |
| 51 | - Made a full port of the library's functionality. I have touched very little of |
| 52 | the actual logic, so most code from the original library should work. |
| 53 | |
| 54 | - Defined and added namespaces to all classes. |
| 55 | |
| 56 | - Replaced all `exit()` / `die()` commands with `throw` statements. |
| 57 | |
| 58 | - Refactored the code to meet PSR-2 standard and added annotations (as best as I could figure them out) |
| 59 | to methods Also, typehinting was added to methods where possible, so some backwards compatibility breaks |
| 60 | may occur if you did some weird things. |
| 61 | |
| 62 | - Moved all constants to a [](constants.phpsingle file](constants.php](constants.php). It is loaded automatically |
| 63 | through Composer, so no need for manual action. |
| 64 | |
| 65 | License: |
| 66 | ======== |
| 67 | |
| 68 | It was previously stated that this package uses the [](https://opensource.org/licenses/MITMIT](https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT) license, |
| 69 | which did not meet the requirements set by the original author. It is now under the |
| 70 | [](http://www.gnu.org/licenses/gpl-3.0.htmlGNU GPL v3](http://www.gnu.org/licenses/gpl-3.0.html](http://www.gnu.org/licenses/gpl-3.0.html) license, so if you wish to |
| 71 | use it in a commercial project, you need to pay an [](http://www.pchart.net/licenseappropriate fee](http://www.pchart.net/license](http://www.pchart.net/license). |
| 72 | |
| 73 | Contributing: |
| 74 | ============= |
| 75 | |
| 76 | All in all, this is a legacy library ported over from PHP 4, so the code is neither |
| 77 | beautiful nor easy to understand. I did my best to modernize and cover it with |
| 78 | some basic tests, but there is much more that could be done. If you are willing and |
| 79 | have time to fix or improve anything, feel free to post a PR or issue. |
| 80 | |
| 81 | Installation (via Composer): |
| 82 | ============================ |
| 83 | |
| 84 | For composer installation, add: |
| 85 | |
| 86 | ```json |
| 87 | "require": { |
| 88 | "szymach/c-pchart": "^3.0" |
| 89 | }, |
| 90 | ``` |
| 91 | |
| 92 | to your composer.json file and update your dependencies. Or you can run: |
| 93 | |
| 94 | ```sh |
| 95 | $ composer require szymach/c-pchart |
| 96 | ``` |
| 97 | |
| 98 | in your project's root directory. |
| 99 | |
| 100 | Usage: |
| 101 | ====== |
| 102 | |
| 103 | Your best source to understanding how to use the library is still the [](http://wiki.pchart.net/official wiki](http://wiki.pchart.net/](http://wiki.pchart.net/). |
| 104 | However, I have ported at least one example for each chart into Markdown files, |
| 105 | so you can compare each version and figure out how to use the current implementation. |
| 106 | |
| 107 | Charts created through Image class |
| 108 | --------------------------------------- |
| 109 | |
| 110 | Most of the basic charts are created through methods of the `CpChart\Image` |
| 111 | class. Below you can find a full list of these charts, alongside example code. |
| 112 | |
| 113 | - [](resources/doc/area.mdarea](resources/doc/area.md](resources/doc/area.md) |
| 114 | - [](resources/doc/bar.mdbar](resources/doc/bar.md](resources/doc/bar.md) |
| 115 | - [](resources/doc/best_fit.mdbest fit](resources/doc/best_fit.md](resources/doc/best_fit.md) |
| 116 | - [](resources/doc/filled_spline.mdfilled spline](resources/doc/filled_spline.md](resources/doc/filled_spline.md) |
| 117 | - [](resources/doc/filled_step.mdfilled step](resources/doc/filled_step.md](resources/doc/filled_step.md) |
| 118 | - [](resources/doc/line.mdline](resources/doc/line.md](resources/doc/line.md) |
| 119 | - [](resources/doc/plot.mdplot](resources/doc/plot.md](resources/doc/plot.md) |
| 120 | - [](resources/doc/progress.mdprogress](resources/doc/progress.md](resources/doc/progress.md) |
| 121 | - [](resources/doc/spline.mdspline](resources/doc/spline.md](resources/doc/spline.md) |
| 122 | - [](resources/doc/stacked_area.mdstacked area](resources/doc/stacked_area.md](resources/doc/stacked_area.md) |
| 123 | - [](resources/doc/stacked_bar.mdstacked bar](resources/doc/stacked_bar.md](resources/doc/stacked_bar.md) |
| 124 | - [](resources/doc/step.mdstep](resources/doc/step.md](resources/doc/step.md) |
| 125 | - [](resources/doc/zone.mdzone](resources/doc/zone.md](resources/doc/zone.md) |
| 126 | |
| 127 | Standalone charts: |
| 128 | ------------------------------------ |
| 129 | |
| 130 | The more advanced charts have their own separate class you need to use in order |
| 131 | to create them. As before, below is a full list of these, with example code. |
| 132 | |
| 133 | - [](resources/doc/2d_pie.md2D pie](resources/doc/2d_pie.md](resources/doc/2d_pie.md) |
| 134 | - [](resources/doc/3d_pie.md3D pie](resources/doc/3d_pie.md](resources/doc/3d_pie.md) |
| 135 | - [](resources/doc/2d_ring.md2D ring](resources/doc/2d_ring.md](resources/doc/2d_ring.md) |
| 136 | - [](resources/doc/3d_ring.md3D ring](resources/doc/3d_ring.md](resources/doc/3d_ring.md) |
| 137 | - [](resources/doc/bubble.mdbubble](resources/doc/bubble.md](resources/doc/bubble.md) |
| 138 | - [](resources/doc/contour.mdcontour](resources/doc/contour.md](resources/doc/contour.md) |
| 139 | - [](resources/doc/polar.mdpolar](resources/doc/polar.md](resources/doc/polar.md) |
| 140 | - [](resources/doc/radar.mdradar](resources/doc/radar.md](resources/doc/radar.md) |
| 141 | - [](resources/doc/scatter_best_fit.mdscatter best fit](resources/doc/scatter_best_fit.md](resources/doc/scatter_best_fit.md) |
| 142 | - [](resources/doc/scatter_line.mdscatter line](resources/doc/scatter_line.md](resources/doc/scatter_line.md) |
| 143 | - [](resources/doc/scatter_plot.mdscatter plot](resources/doc/scatter_plot.md](resources/doc/scatter_plot.md) |
| 144 | - [](resources/doc/scatter_spline.mdscatter spline](resources/doc/scatter_spline.md](resources/doc/scatter_spline.md) |
| 145 | - [](resources/doc/scatter_threshold.mdscatter threshold](resources/doc/scatter_threshold.md](resources/doc/scatter_threshold.md) |
| 146 | - [](resources/doc/scatter_threshold_area.mdscatter threshold area](resources/doc/scatter_threshold_area.md](resources/doc/scatter_threshold_area.md) |
| 147 | - [](resources/doc/split_path.mdsplit path](resources/doc/split_path.md](resources/doc/split_path.md) |
| 148 | - [](resources/doc/spring.mdspring](resources/doc/spring.md](resources/doc/spring.md) |
| 149 | - [](resources/doc/stock.mdstock](resources/doc/stock.md](resources/doc/stock.md) |
| 150 | - [](resources/doc/surface.mdsurface](resources/doc/surface.md](resources/doc/surface.md) |
| 151 | |
| 152 | Barcodes |
| 153 | -------- |
| 154 | |
| 155 | The pChart library also provides a way to render barcodes 39 and 128. Below you |
| 156 | can find links to doc on creating them: |
| 157 | |
| 158 | - [](resources/doc/barcode_39.mdbarcode39](resources/doc/barcode_39.md](resources/doc/barcode_39.md) |
| 159 | - [](resources/doc/barcode_128.mdbarcode128](resources/doc/barcode_128.md](resources/doc/barcode_128.md) |
| 160 | |
| 161 | Cache |
| 162 | ----- |
| 163 | |
| 164 | If you find yourself creating charts out of a set of data more than once, you may |
| 165 | consider using the cache component of the library. Head on to the [](resources/doc/cache.mddedicated part](resources/doc/cache.md](resources/doc/cache.md) |
| 166 | of the documentation for information on how to do that. |
| 167 | |
| 168 | Fonts and palletes |
| 169 | ------------------ |
| 170 | |
| 171 | If you want to use any of the fonts or palletes files, provide only |
| 172 | the name of the actual file, do not add the `fonts` or `palettes` folder to the |
| 173 | string given into the function. If you want to load them from a different directory |
| 174 | than the default, you need to add the full path to the file (ex. `__DIR__.'/folder/to/my/palletes`). |
| 175 | |
| 176 | References |
| 177 | ========== |
| 178 | [](http://www.pchart.net/The original pChart website](http://www.pchart.net/](http://www.pchart.net/) |
| 179 | |
| 180 | Links |
| 181 | ===== |
| 182 | |
| 183 | [](https://github.com/szymach/c-pchartGitHub](https://github.com/szymach/c-pchart](https://github.com/szymach/c-pchart) |
| 184 | |
| 185 | [](https://packagist.org/packages/szymach/c-pchartPackagist](https://packagist.org/packages/szymach/c-pchart](https://packagist.org/packages/szymach/c-pchart) |
| 186 |