diff --git a/views/chart.php b/views/chart.php index 578b7a0..92be1e0 100644 --- a/views/chart.php +++ b/views/chart.php @@ -32,17 +32,21 @@ function renderChart( ) { $durations = [ -// '30d'=> [ -// 'duration' => 60 * 60 * 24 * 30, -// 'resolution' => 7200 // 2h -// ], + '1y'=> [ + 'duration' => 60 * 60 * 24 * 365, + 'resolution' => 86400 // 1d + ], + '30d'=> [ + 'duration' => 60 * 60 * 24 * 30, + 'resolution' => 7200 // 2h + ], '7d'=> [ 'duration' => 60 * 60 * 24 * 7, 'resolution' => 1800 // 30m ], '24h' => [ 'duration' => 60 * 60 * 24 * 1, - 'resolution' => 900 // 15m + 'resolution' => 300 // 15m ] ]; @@ -92,12 +96,12 @@ function renderChart( } $poloniexChart = new NeatCharts\LineChart($chartData, [ - 'width'=>800, - 'height'=>200, + 'width'=>$width, + 'height'=>$height, 'lineColor'=>($theme == 'dark' ? '#000' : '#fff'), 'labelColor'=>($theme == 'dark' ? '#000' : '#fff'), 'smoothed'=>false, - 'fontSize'=>12 + 'fontSize'=>$fontSize ]); $result = $poloniexChart->render(); @@ -110,7 +114,7 @@ function renderChart( $im->clear(); $im->destroy(); } - CacheManager::set($chartCacheKey, $result); + CacheManager::set($chartCacheKey, $result, $dataResolution); $resultExpires = time() + $dataResolution; } else { $resultExpires = CacheManager::getInfo($chartCacheKey)[ 'expired_time' ]; diff --git a/views/index.php b/views/index.php index 36a8e0b..12b8612 100644 --- a/views/index.php +++ b/views/index.php @@ -77,8 +77,8 @@

SVG and PNG charts with your favorite cryptocurrencies

- Poloniex Dash/BTC price -
7 Day Dash price in BTC http://cryptohistory.org/charts/light/dash-btc/7d/svg
+ Poloniex Dash/BTC price +
30 Day Dash price in BTC http://cryptohistory.org/charts/light/dash-btc/30d/svg
@@ -87,14 +87,14 @@ http://cryptohistory.org/charts/{theme}/{currency}-btc/{timespan}/{format}

Theme: dark or light. (More planned)

Currency: anything active on Poloniex. Prices are all in bitcoin.

-

Timespan: 7d or 24h. (More planned)

+

Timespan: 1y, 30d, 7d, or 24h.

Format: svg (best) or png.

Examples:

Ethereum 24h, dark SVG: http://cryptohistory.org/charts/dark/eth-btc/24h/svg

-

Litecoin 7d, light colored PNG: http://cryptohistory.org/charts/dark/ltc-btc/7d/png

-

Factom 7d, dark SVG: http://cryptohistory.org/charts/dark/fct-btc/24h/svg

+

Litecoin 30d, light colored PNG: http://cryptohistory.org/charts/dark/ltc-btc/30d/png

+

Doge 1y, dark SVG: http://cryptohistory.org/charts/dark/doge-btc/30d/svg