Skip to content

Commit

Permalink
improved graph styling
Browse files Browse the repository at this point in the history
  • Loading branch information
tat2bu committed Aug 17, 2023
1 parent a75a702 commit 0b8e25d
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions src/extensions/statistics.extension.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ getOwnedTokens(wallet:string) {
average_price: dataMap.get(d)?.average_price ?? 0
}
})
const MAX_BARS = 300
const MAX_BARS = 250
if (datas.length > MAX_BARS) {
const packSize = Math.floor(datas.length/MAX_BARS)
let count = 0
Expand All @@ -427,7 +427,8 @@ getOwnedTokens(wallet:string) {
}
const width = 1200;
const height = 600;
const datasets:any[] = [{
const datasets:any[] = [
{
label: 'Volume (Ξ)',
data: datas.map(d => d.volume),
backgroundColor: [
Expand All @@ -438,19 +439,22 @@ getOwnedTokens(wallet:string) {
],
borderWidth: 1,
yAxisID: 'y1',
}, {
type: 'line',
label: 'Average price (Ξ)',
data: datas.map(d => d.average_price),
backgroundColor: [
'#EB37B0'
],
borderColor: [
'#EB37B0'
],
borderWidth: 2,
yAxisID: 'y',
}]
if (!wallet) {
datasets.push({
type: 'line',
label: 'Average price (Ξ)',
data: datas.map(d => d.average_price),
backgroundColor: [
'#EB37B0'
],
borderColor: [
'#EB37B0'
],
borderWidth: 1,
yAxisID: 'y',
})
}
const configuration:ChartConfiguration = {
type: 'bar',
data: {
Expand All @@ -468,6 +472,10 @@ getOwnedTokens(wallet:string) {
type: 'linear',
display: true,
position: 'left',
grid: {
color: (ctx) => (ctx.tick.value === 0 ? '#6A8493' : 'transparent'),
drawTicks: false,
}
},
y1: {
type: 'linear',
Expand Down

0 comments on commit 0b8e25d

Please sign in to comment.