Feat : chart v1

quy_fe
Quy_FE 2 months ago
parent 1fb26ff5a8
commit b1674a9ce9
  1. 2
      src/_components/boxChart/BoxDoughnutBarChart.js
  2. 10
      src/_components/boxChart/boxChart.scss
  3. 18
      src/_components/chart/VerticalBarChart.js

@ -71,7 +71,7 @@ export default function BoxDoughnutBarChart({
{subTitleLine && <p className='box-chart-subtitle'>{subTitleLine}</p>}
{dataBarChart.length > 0 ? (
<div className='chart-container'>
<div className='flex-1' style={{ padding: '1.6rem 0', height: '100%', width: '360px' }}>
<div className='flex-1' style={{ padding: '1.6rem 0', height: '100%'}}>
<VerticalBarChart data={dataBarChart} labels={labelsBarChart} />
</div>
</div>

@ -60,13 +60,13 @@
}
.chart-container {
overflow-x: scroll;
// overflow-x: scroll;
height: 100%;
width: 300px;
// width: 300px;
@media (max-width: 1750px) {
max-width: 240px;
}
// @media (max-width: 1750px) {
// max-width: 240px;
// }
}
}

@ -15,7 +15,8 @@ export function VerticalBarChart({data = [], labels = []}) {
maxValue = item;
}
})
// labels = labels?.map((item) => item.replace('Tuần', 'W'));
labels = labels?.map(week => week.split(" "));
const options = {
responsive: true,
@ -24,15 +25,21 @@ export function VerticalBarChart({data = [], labels = []}) {
legend: {
display: false
},
// title: {
// display: true,
// text: 'Tuần',
// align: 'start',
// position: 'bottom',
// },
datalabels: {
anchor: 'end', // Position of the labels (start, end, center, etc.)
align: 'end', // Alignment of the labels (start, end, center, etc.)
color: 'blue', // Color of the labels
anchor: 'end',
align: 'end',
color: 'blue',
font: {
weight: 'bold',
},
formatter: function (value, context) {
return value; // Display the actual data value
return value;
}
}
},
@ -40,7 +47,6 @@ export function VerticalBarChart({data = [], labels = []}) {
x: {
ticks: {
maxRotation: 0,
// scrollX : true,
},
},
y: {

Loading…
Cancel
Save