Skip to content

Commit

Permalink
add y-axis on right-hand side (but without ticks)
Browse files Browse the repository at this point in the history
  • Loading branch information
second-slip committed Aug 2, 2024
1 parent ea20f75 commit 829795c
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 3 deletions.
19 changes: 19 additions & 0 deletions src/app/age-analysis-line/age-analysis-line.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,25 @@ export class AgeAnalysisLineComponent {
// display: true,
// text: 'JM Anderson',
// }
},
scales: {
y: {
type: 'linear',
display: true,
position: 'left',
},
y1: {
type: 'linear',
display: true,
position: 'right',
ticks: {
display: false
},
// grid line settings
grid: {
drawOnChartArea: false, // only want the grid lines for one axis to show up
},
}
}
};
}
19 changes: 19 additions & 0 deletions src/app/cumulative-ave-line/cumulative-ave-line.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,25 @@ export class CumulativeAveLineComponent {
// display: true,
// text: 'JM Anderson',
// }
},
scales: {
y: {
type: 'linear',
display: true,
position: 'left',
},
y1: {
type: 'linear',
display: true,
position: 'right',
ticks: {
display: false
},
// grid line settings
grid: {
drawOnChartArea: false, // only want the grid lines for one axis to show up
},
}
}
};
}
21 changes: 20 additions & 1 deletion src/app/economy-rate/economy-rate.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class EconomyRateComponent {
onResize() {
this.chart?.chart?.resize();
}

public loaded = signal(false);

public bowlingEconomyData: ChartData<'line'> = {
Expand Down Expand Up @@ -59,6 +59,25 @@ export class EconomyRateComponent {
legend: {
position: 'bottom'
}
},
scales: {
y: {
type: 'linear',
display: true,
position: 'left',
},
y1: {
type: 'linear',
display: true,
position: 'right',
ticks: {
display: false
},
// grid line settings
grid: {
drawOnChartArea: false, // only want the grid lines for one axis to show up
},
}
}
};
}
19 changes: 19 additions & 0 deletions src/app/format-analysis-line/format-analysis-line.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,25 @@ export class FormatAnalysisLineComponent {
// display: true,
// text: 'JM Anderson',
// }
},
scales: {
y: {
type: 'linear',
display: true,
position: 'left',
},
y1: {
type: 'linear',
display: true,
position: 'right',
ticks: {
display: false
},
// grid line settings
grid: {
drawOnChartArea: false, // only want the grid lines for one axis to show up
},
}
}
};
}
45 changes: 43 additions & 2 deletions src/app/strike-rate/strike-rate.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export class StrikeRateComponent implements OnInit {
datasets: [
{
data: [],
label: 'cumulative strike rate'
label: 'cumulative strike rate',
yAxisID: 'y'
}
]
};
Expand Down Expand Up @@ -68,9 +69,30 @@ export class StrikeRateComponent implements OnInit {
this.btnText.set('Reset axis');
}
this.lineChartOptions = {
// scales: {
// y: {
// min: this.axis()
// }
// },
scales: {
y: {
min: this.axis()
min: this.axis(),
type: 'linear',
display: true,
position: 'left',
},
y1: {
min: this.axis(),
type: 'linear',
display: true,
position: 'right',
ticks: {
display: false
},
// grid line settings
grid: {
drawOnChartArea: false, // only want the grid lines for one axis to show up
},
}
},
responsive: true, maintainAspectRatio: false,
Expand Down Expand Up @@ -110,6 +132,25 @@ export class StrikeRateComponent implements OnInit {
// alert('k')
// this.chart?.chart?.resize();//.update();
// },
scales: {
y: {
type: 'linear',
display: true,
position: 'left',
},
y1: {
type: 'linear',
display: true,
position: 'right',
ticks: {
display: false
},
// grid line settings
grid: {
drawOnChartArea: false, // only want the grid lines for one axis to show up
},
},
},
maintainAspectRatio: false,
devicePixelRatio: 4,
responsive: true,
Expand Down

0 comments on commit 829795c

Please sign in to comment.