pull/2538/head
Ayrat Badykov 5 years ago
parent c9966750b9
commit b944d936cf
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 12
      apps/block_scout_web/assets/js/lib/coin_balance_history_chart.js
  2. 1
      apps/explorer/lib/explorer/chain/address/coin_balance.ex

@ -18,13 +18,13 @@ export function createCoinBalanceHistoryChart (el) {
y: balance.value y: balance.value
})) }))
var step_size = 3 var stepSize = 3
if (data.length > 2) { if (data.length > 2) {
console.log(data[0].date) var diff = Math.abs(new Date(data[0].date) - new Date(data[1].date))
var diff = Math.abs(new Date(data[0].date) - new Date(data[1].date)); var periodInDays = diff / (1000 * 60 * 60 * 24)
var period_in_days = diff / (1000 * 60 * 60 * 24) console.log(periodInDays)
step_size = period_in_days stepSize = periodInDays
} }
return new Chart(el, { return new Chart(el, {
type: 'line', type: 'line',
@ -44,7 +44,7 @@ export function createCoinBalanceHistoryChart (el) {
type: 'time', type: 'time',
time: { time: {
unit: 'day', unit: 'day',
stepSize: step_size stepSize: stepSize
} }
}], }],
yAxes: [{ yAxes: [{

@ -115,7 +115,6 @@ defmodule Explorer.Chain.Address.CoinBalance do
|> select([cb, b], %{timestamp: b.timestamp}) |> select([cb, b], %{timestamp: b.timestamp})
end end
def changeset(%__MODULE__{} = balance, params) do def changeset(%__MODULE__{} = balance, params) do
balance balance
|> cast(params, @allowed_fields) |> cast(params, @allowed_fields)

Loading…
Cancel
Save