2017 © Pedro Peláez
 

library neat-charts

Generates clean-looking SVG charts

image

seigler/neat-charts

Generates clean-looking SVG charts

  • Tuesday, March 7, 2017
  • by seigler
  • Repository
  • 1 Watchers
  • 7 Stars
  • 20 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

seigler/neat-charts GitHub stars Packagist License

PHP project to generate clean-looking SVG price charts, (*1)

Dash 24h price in BTC from Poloniex
30 days of Dash price in Bitcoin from Poloniex.com, (*2)

Ethereum 7-day price in BTC from Poloniex Ethereum 7d price in BTC from Poloniex, (*3)

More examples at cryptohistory.org., (*4)

Requirements

  • PHP >=5.3.0

Installation

Using Composer

To install using Composer, you will have to install Composer first., (*5)

curl -s https://getcomposer.org/installer | php, (*6)

Create a composer.json file in your project root. Then run this command in your project folder:, (*7)

composer require seigler/neat-charts, (*8)

Tell Composer to install the required dependencies., (*9)

php composer.phar install, (*10)

If you want to use the autoloading provided by Composer, add the following line to your application file., (*11)

require 'vendor/autoload.php';, (*12)

You are now ready to use NeatCharts., (*13)

Install NeatCharts manually

Download the folder NeatCharts (in src) and place it alongside your php file. Add the following at the top of your PHP file:, (*14)

spl_autoload_extensions(".php");
spl_autoload_register();

This will automatically require the correct files when they are referenced, since the namespace and class names match the folder structure., (*15)

Usage

Header('Content-type: image/svg+xml; charset=utf-8');

$chart = new NeatCharts/LineChart($chartData, [ // all parameters optional
  'width'=>800,
  'height'=>250,
  'lineColor'=>"#1C75BC",
  'labelColor'=>"#777",
  'smoothed'=>false
]);
print '';
print $chart->render();

In your HTML: <img src="path to the PHP file">, (*16)

There are more demos available in demo.php and demo-as-image.php., (*17)

Available Options

LineChart

Option Default
width 800
height 250
lineColor '#000'
markerColor '#000'
labelColor '#000'
smoothed false
fontSize 15
yAxisEnabled true
xAxisEnabled false
yAxisZero false
filled false

BarChart

Option Default
width 600
height 300
barColor '#000'
markerColor '#000'
labelColor '#000'
fontSize 15
yAxisEnabled true
xAxisEnabled false
yAxisZero true

CandlestickChart

Option Default
width 1200
height 300
barColor '#000'
risingFillColor '#0D0'
fallingFillColor '#D00'
markerColor '#000'
labelColor '#000'
fontSize 15
yAxisEnabled true
xAxisEnabled false
yAxisZero false

Credits

  • Chart appearance based on advice found at http://vis4.net/blog/posts/doing-the-line-charts-right/

The Versions

07/03 2017

dev-master

9999999-dev https://github.com/seigler/neat-charts

Generates clean-looking SVG charts

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

chart svg charts