Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buddies2705/297422245dc7ad294511ba2460ba997d to your computer and use it in GitHub Desktop.
Save buddies2705/297422245dc7ad294511ba2460ba997d to your computer and use it in GitHub Desktop.
Bitquery Widget Bitcoin Transactions over time widget
<!DOCTYPE html>
<html>
<head>
<title>Bitqyery Widget- Bitcoin Transactions over <time></time></title>
<link rel="stylesheet" media="all" href="https://cdn.jsdelivr.net/gh/bitquery/widgets@v1.3.5/dist/assets/css/widgets.css">
<script src="https://cdn.jsdelivr.net/gh/bitquery/widgets@v1.3.5/dist/widgets.js"></script>
</head>
<body>
<div id="transactions_by_time"></div>
</body>
<script>
(function(){
widgets.init('https://graphql.bitquery.io', '', {locale: 'en', theme: 'light'});
var query = new widgets.query(`
query ($network: BitcoinNetwork!,
$dateFormat: String!,
$from: ISO8601DateTime,
$till: ISO8601DateTime){
bitcoin(network: $network ){
transactions(options:{asc: "date.date"}, date: {
since: $from
till: $till}
) {
date: date{
date(format: $dateFormat)
}
count: count
feeValue
avgFee: feeValue(calculate: average)
}
}
}`);
var wdts = new widgets.chartByTime('#transactions_by_time', query, 'bitcoin.transactions', {
"title": "Transactions By Date",
"chartOptions": {
"vAxes": {
"0": {
"title": "Transactions count"
}
},
"seriesType": "bars",
"series": {
"0": {
"color": "#28a745"
}
}
},
"dataOptions": [
{
"title": {
"label": "Date",
"type": "date"
},
"path": "date.date"
},
{
"title": "Transactions count",
"path": "count"
}
]
});
query.request({"limit": 10, "offset": 0, "network": "bitcoin", "from": null, "till": null, "dateFormat": "%Y-%m"});
})()
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment