Bitcoin Forum
June 17, 2019, 06:16:34 AM *
News: Latest Bitcoin Core release: 0.18.0 [Torrent] (New!)
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to develop a bitcoin price chart?  (Read 558 times)
Coinbuddy
Hero Member
*****
Offline Offline

Activity: 896
Merit: 1000



View Profile
July 10, 2015, 10:11:34 AM
 #1

Developers please guide us how to develop a bitcoin chart using www.chartjs.org and also for other altcoin.

Show by examples!

Mine RVN and with 0% mining fees and get paid in BTC, ETH, XMR or RVN.

www.cudominer.com Get Cudo Miner
Auto coin switching, third-party miners, overclocking and remote management (Win/Linux)
Run from a USB stick or install from an ISO image (Linux)
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1560752194
Hero Member
*
Offline Offline

Posts: 1560752194

View Profile Personal Message (Offline)

Ignore
1560752194
Reply with quote  #2

1560752194
Report to moderator
coinableS
Legendary
*
Offline Offline

Activity: 1078
Merit: 1001



View Profile WWW
July 11, 2015, 12:07:36 AM
 #2

Are you just looking for a simple line chart?
Personally, I would create PHP file that pulled the current price and then log the time and price to a database . I'd set a cron job so that it runs once every minute. So you'd have a sql table that looked something like this:

Code:
-------------------------
price         |     time
====================
285.24      |     8:57
285.88      |     8:56
283.65      |     8:55
284.01      |     8:54

From there just query your database and do a loop for each price instance that is in your database. Output your loops into the Labels and Data variables in the JS.

Code:
<script>
    var sqlPrices=[<?php 
    
while($info=mysqli_fetch_array($data))
        echo 
$info['price'].','
    
?>
];
    <?php
    $data
=mysqli_query($mysqli,"SELECT * FROM priceTable");
    
?>

    var sqlLabels=[<?php 
    
while($info=mysqli_fetch_array($data))
        echo 
'"'.$info['time'].'",'
    
?>
];
    </script>

Code:
var data = {
    labels: [sqlLabels],
    datasets: [
        {
            label: "My First dataset",
            fillColor: "rgba(220,220,220,0.2)",
            strokeColor: "rgba(220,220,220,1)",
            pointColor: "rgba(220,220,220,1)",
            pointStrokeColor: "#fff",
            pointHighlightFill: "#fff",
            pointHighlightStroke: "rgba(220,220,220,1)",
            data: [sqlPrices]
        }
    ]
};


Jeremycoin
Legendary
*
Offline Offline

Activity: 980
Merit: 1003


𝓗𝓞𝓓𝓛


View Profile
July 11, 2015, 02:51:51 AM
 #3

You want to make a Bitcoin price chart, please inform me when it finish. Cheesy
I maybe can try it

Faucet used to be profitable
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!