Created
July 29, 2020 12:19
-
-
Save buddies2705/297422245dc7ad294511ba2460ba997d to your computer and use it in GitHub Desktop.
Bitquery Widget Bitcoin Transactions over time widget
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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/[email protected]/dist/assets/css/widgets.css"> | |
<script src="https://cdn.jsdelivr.net/gh/bitquery/[email protected]/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