mirror of
https://github.com/FlipsideCrypto/flipside-js.git
synced 2026-02-06 10:48:11 +00:00
Fix distance
This commit is contained in:
parent
604baaad0c
commit
0c045a557e
28
index.html
28
index.html
@ -29,19 +29,31 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper"><div id="widget-0"></div></div>
|
||||
<div class="wrapper"><div id="widget-1"></div></div>
|
||||
<div class="wrapper"><div id="widget-0" style="width: 289px;"></div></div>
|
||||
<div class="wrapper"><div id="widget-1" style="width: 289px;"></div></div>
|
||||
<div class="wrapper"><div id="widget-2"></div></div>
|
||||
|
||||
<script>
|
||||
const flipside = new Flipside("<YOUR_API_KEY>");
|
||||
flipside.createFCAS("widget-0", "btc", {
|
||||
highlights: ["EOS", "ETH", "QTUM", "ZRX", "BTC", "ZEC", "LTC"]
|
||||
});
|
||||
flipside.createFCAS("widget-1", "btc", {
|
||||
const flipside = new Flipside("a7936778-4f87-4790-889f-3ab617271458");
|
||||
// flipside.createFCAS("widget-0", "nmr", {
|
||||
// highlights: ["BTC", "ETH", "QTUM"]
|
||||
// });
|
||||
flipside.createFCAS("widget-1", "zrx", {
|
||||
logo: false,
|
||||
mini: true,
|
||||
dark: true
|
||||
dark: true,
|
||||
bucketDistance: 100,
|
||||
highlights: [
|
||||
"BTC",
|
||||
"ETH",
|
||||
"eos",
|
||||
"qtum",
|
||||
"nmr",
|
||||
"ltc",
|
||||
"gnt",
|
||||
"rep",
|
||||
"mln"
|
||||
]
|
||||
});
|
||||
flipside.createTable("widget-2", "btc", {
|
||||
dark: true,
|
||||
|
||||
@ -129,14 +129,12 @@ export default class Plot extends Component {
|
||||
const nextAsset =
|
||||
i !== highlightLength - 1 ? sortedHighLights[i + 1] : null;
|
||||
|
||||
// const prevDist = Math.abs(prevAsset.value - currentAsset.value);
|
||||
const prevDist = Math.abs(anchorX - currentAsset.value);
|
||||
const nextDist = nextAsset
|
||||
? Math.abs(nextAsset.value - currentAsset.value)
|
||||
: 1000000;
|
||||
// const nextDist = nextAsset
|
||||
// ? Math.abs(nextAsset.value - currentAsset.value)
|
||||
// : 1000000;
|
||||
|
||||
// Is closer to previous or next?
|
||||
if (prevDist < nextDist && prevDist <= bucketDistance) {
|
||||
if (prevDist <= bucketDistance) {
|
||||
buckets[currentBucketIndex].push(currentAsset);
|
||||
scoresToBuckets[currentAsset.value] = currentBucketIndex;
|
||||
} else {
|
||||
@ -192,7 +190,7 @@ export default class Plot extends Component {
|
||||
.filter(i => i.symbol != symbol.toUpperCase());
|
||||
|
||||
const { buckets, scoresToBuckets } = this.getBuckets();
|
||||
|
||||
console.log("buckets: ", buckets, "scoresToBuckets: ", scoresToBuckets);
|
||||
return (
|
||||
<svg class="fs-plot" width="100%" height="104" overflow="visible">
|
||||
<defs>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user