feat(wallet): Fixed balance history chart to use new balance history data based on transfers
This commit is contained in:
parent
7171094f01
commit
955169112d
|
@ -141,7 +141,7 @@ Item {
|
||||||
yAxisId: 'y-axis-1',
|
yAxisId: 'y-axis-1',
|
||||||
backgroundColor: (Theme.palette.name === "dark") ? 'rgba(136, 176, 255, 0.2)' : 'rgba(67, 96, 223, 0.2)',
|
backgroundColor: (Theme.palette.name === "dark") ? 'rgba(136, 176, 255, 0.2)' : 'rgba(67, 96, 223, 0.2)',
|
||||||
borderColor: (Theme.palette.name === "dark") ? 'rgba(136, 176, 255, 1)' : 'rgba(67, 96, 223, 1)',
|
borderColor: (Theme.palette.name === "dark") ? 'rgba(136, 176, 255, 1)' : 'rgba(67, 96, 223, 1)',
|
||||||
borderWidth: 3,
|
borderWidth: graphDetail.selectedGraphType === AssetsDetailView.GraphType.Price ? 3 : 2,
|
||||||
pointRadius: 0,
|
pointRadius: 0,
|
||||||
data: RootStore.marketHistoryIsLoading ? [] : graphDetail.dataRange,
|
data: RootStore.marketHistoryIsLoading ? [] : graphDetail.dataRange,
|
||||||
parsing: false,
|
parsing: false,
|
||||||
|
@ -156,6 +156,11 @@ Item {
|
||||||
legend: {
|
legend: {
|
||||||
display: false
|
display: false
|
||||||
},
|
},
|
||||||
|
elements: {
|
||||||
|
line: {
|
||||||
|
cubicInterpolationMode: 'monotone' // without it interpolation makes the line too curvy that can extend horizontally farther then data points
|
||||||
|
}
|
||||||
|
},
|
||||||
//TODO enable zoom
|
//TODO enable zoom
|
||||||
//zoom: {
|
//zoom: {
|
||||||
// enabled: true,
|
// enabled: true,
|
||||||
|
@ -173,8 +178,9 @@ Item {
|
||||||
if (label) {
|
if (label) {
|
||||||
label += ': ';
|
label += ': ';
|
||||||
}
|
}
|
||||||
label += tooltipItem.yLabel.toFixed(2);
|
|
||||||
return label.slice(0,label.indexOf(":")+1) + " %1".arg(RootStore.currencyStore.currentCurrencySymbol) + label.slice(label.indexOf(":") + 2, label.length);
|
const value = LocaleUtils.currencyAmountToLocaleString({ amount: tooltipItem.yLabel.toFixed(2), symbol: RootStore.currencyStore.currentCurrencySymbol })
|
||||||
|
return label + value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -182,6 +188,7 @@ Item {
|
||||||
xAxes: [{
|
xAxes: [{
|
||||||
id: 'x-axis-1',
|
id: 'x-axis-1',
|
||||||
position: 'bottom',
|
position: 'bottom',
|
||||||
|
type: graphDetail.selectedGraphType === AssetsDetailView.GraphType.Price ? 'category' : 'time',
|
||||||
gridLines: {
|
gridLines: {
|
||||||
drawOnChartArea: false,
|
drawOnChartArea: false,
|
||||||
drawBorder: false,
|
drawBorder: false,
|
||||||
|
@ -195,6 +202,9 @@ Item {
|
||||||
minRotation: 0,
|
minRotation: 0,
|
||||||
maxTicksLimit: graphDetail.maxTicksLimit,
|
maxTicksLimit: graphDetail.maxTicksLimit,
|
||||||
},
|
},
|
||||||
|
time: {
|
||||||
|
minUnit: 'day' // for '7days' timeframe, otherwise labels are '10PM', '10AM', '10PM', etc
|
||||||
|
}
|
||||||
}],
|
}],
|
||||||
yAxes: [{
|
yAxes: [{
|
||||||
position: 'left',
|
position: 'left',
|
||||||
|
|
|
@ -31,27 +31,22 @@ ChartStoreBase {
|
||||||
switch(timeRange) {
|
switch(timeRange) {
|
||||||
case ChartStoreBase.TimeRange.Weekly:
|
case ChartStoreBase.TimeRange.Weekly:
|
||||||
root.weeklyData = balanceData
|
root.weeklyData = balanceData
|
||||||
root.weeklyTimeRange = timeRangeData
|
|
||||||
root.weeklyMaxTicks = 0
|
root.weeklyMaxTicks = 0
|
||||||
break;
|
break;
|
||||||
case ChartStoreBase.TimeRange.Monthly:
|
case ChartStoreBase.TimeRange.Monthly:
|
||||||
root.monthlyData = balanceData
|
root.monthlyData = balanceData
|
||||||
root.monthlyTimeRange = timeRangeData
|
|
||||||
root.monthlyMaxTicks = 0
|
root.monthlyMaxTicks = 0
|
||||||
break;
|
break;
|
||||||
case ChartStoreBase.TimeRange.HalfYearly:
|
case ChartStoreBase.TimeRange.HalfYearly:
|
||||||
root.halfYearlyData = balanceData
|
root.halfYearlyData = balanceData
|
||||||
root.halfYearlyTimeRange = timeRangeData
|
|
||||||
root.halfYearlyMaxTicks = 0
|
root.halfYearlyMaxTicks = 0
|
||||||
break;
|
break;
|
||||||
case ChartStoreBase.TimeRange.Yearly:
|
case ChartStoreBase.TimeRange.Yearly:
|
||||||
root.yearlyData = balanceData
|
root.yearlyData = balanceData
|
||||||
root.yearlyTimeRange = timeRangeData
|
|
||||||
root.yearlyMaxTicks = 0
|
root.yearlyMaxTicks = 0
|
||||||
break;
|
break;
|
||||||
case ChartStoreBase.TimeRange.All:
|
case ChartStoreBase.TimeRange.All:
|
||||||
root.allData = balanceData
|
root.allData = balanceData
|
||||||
root.allTimeRange = timeRangeData
|
|
||||||
root.allTimeRangeTicks = 0
|
root.allTimeRangeTicks = 0
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -92,20 +87,13 @@ ChartStoreBase {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var tmpTimeRange = []
|
|
||||||
var tmpDataValues = []
|
var tmpDataValues = []
|
||||||
for(let i = 0; i < response.historicalData.length; i++) {
|
for(let i = 0; i < response.historicalData.length; i++) {
|
||||||
let dataEntry = response.historicalData[i]
|
let dataEntry = response.historicalData[i]
|
||||||
|
tmpDataValues.push({ x: new Date(dataEntry.time * 1000), y: dataEntry.value })
|
||||||
let dateString = response.timeInterval == ChartStoreBase.TimeRange.Weekly || response.timeInterval == ChartStoreBase.TimeRange.Monthly
|
|
||||||
? LocaleUtils.getDayMonth(dataEntry.time * 1000)
|
|
||||||
: LocaleUtils.getMonthYear(dataEntry.time * 1000)
|
|
||||||
tmpTimeRange.push(dateString)
|
|
||||||
|
|
||||||
tmpDataValues.push(dataEntry.value)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
root.setData(response.address, response.tokenSymbol, response.currencySymbol, response.timeInterval, tmpTimeRange, tmpDataValues)
|
root.setData(response.address, response.tokenSymbol, response.currencySymbol, response.timeInterval, [], tmpDataValues)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue