Bitcoin Forum
May 05, 2024, 05:49:19 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to develop a bitcoin price chart?  (Read 638 times)
Coinbuddy (OP)
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!
1714931359
Hero Member
*
Offline Offline

Posts: 1714931359

View Profile Personal Message (Offline)

Ignore
1714931359
Reply with quote  #2

1714931359
Report to moderator
"Your bitcoin is secured in a way that is physically impossible for others to access, no matter for what reason, no matter how good the excuse, no matter a majority of miners, no matter what." -- Greg Maxwell
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714931359
Hero Member
*
Offline Offline

Posts: 1714931359

View Profile Personal Message (Offline)

Ignore
1714931359
Reply with quote  #2

1714931359
Report to moderator
coinableS
Legendary
*
Offline Offline

Activity: 1442
Merit: 1179



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: 1022
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:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!