mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: BarChart to have a stepSize multiplier of 1 instead of auto (#163)
* Fixes the BarChart to have a stepSize multiplier of 1 instead of auto * Moves the size to props as per Discord * Adds the same behavior to StackedBarChart's
This commit is contained in:
@@ -23,6 +23,16 @@ class BarChart extends Component {
|
|||||||
this.myChart = new Chart(this.canvasRef.current, {
|
this.myChart = new Chart(this.canvasRef.current, {
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
options: {
|
options: {
|
||||||
|
x: {
|
||||||
|
ticks: {
|
||||||
|
stepSize: this.props.stepSize
|
||||||
|
}
|
||||||
|
},
|
||||||
|
y: {
|
||||||
|
ticks: {
|
||||||
|
stepSize: this.props.stepSize
|
||||||
|
}
|
||||||
|
},
|
||||||
indexAxis: this.props.horizontal ? 'y' : 'x',
|
indexAxis: this.props.horizontal ? 'y' : 'x',
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
plugins: {
|
plugins: {
|
||||||
@@ -64,7 +74,8 @@ BarChart.propTypes = {
|
|||||||
horizontal: PropTypes.bool,
|
horizontal: PropTypes.bool,
|
||||||
legend: PropTypes.bool,
|
legend: PropTypes.bool,
|
||||||
title: PropTypes.string.isRequired,
|
title: PropTypes.string.isRequired,
|
||||||
kind: PropTypes.oneOf(kinds.all).isRequired
|
kind: PropTypes.oneOf(kinds.all).isRequired,
|
||||||
|
stepSize: PropTypes.number
|
||||||
};
|
};
|
||||||
|
|
||||||
BarChart.defaultProps = {
|
BarChart.defaultProps = {
|
||||||
@@ -72,7 +83,8 @@ BarChart.defaultProps = {
|
|||||||
horizontal: false,
|
horizontal: false,
|
||||||
legend: false,
|
legend: false,
|
||||||
title: '',
|
title: '',
|
||||||
kind: kinds.INFO
|
kind: kinds.INFO,
|
||||||
|
stepSize: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
export default BarChart;
|
export default BarChart;
|
||||||
|
@@ -16,10 +16,16 @@ class StackedBarChart extends Component {
|
|||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
scales: {
|
scales: {
|
||||||
x: {
|
x: {
|
||||||
stacked: true
|
stacked: true,
|
||||||
|
ticks: {
|
||||||
|
stepSize: this.props.stepSize
|
||||||
|
}
|
||||||
},
|
},
|
||||||
y: {
|
y: {
|
||||||
stacked: true
|
stacked: true,
|
||||||
|
ticks: {
|
||||||
|
stepSize: this.props.stepSize
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
plugins: {
|
plugins: {
|
||||||
@@ -63,11 +69,13 @@ class StackedBarChart extends Component {
|
|||||||
|
|
||||||
StackedBarChart.propTypes = {
|
StackedBarChart.propTypes = {
|
||||||
data: PropTypes.object.isRequired,
|
data: PropTypes.object.isRequired,
|
||||||
title: PropTypes.string.isRequired
|
title: PropTypes.string.isRequired,
|
||||||
|
stepSize: PropTypes.number
|
||||||
};
|
};
|
||||||
|
|
||||||
StackedBarChart.defaultProps = {
|
StackedBarChart.defaultProps = {
|
||||||
title: ''
|
title: '',
|
||||||
|
stepSize: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
export default StackedBarChart;
|
export default StackedBarChart;
|
||||||
|
Reference in New Issue
Block a user