Feat : chart v1

uat
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>} {subTitleLine && <p className='box-chart-subtitle'>{subTitleLine}</p>}
{dataBarChart.length > 0 ? ( {dataBarChart.length > 0 ? (
<div className='chart-container'> <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} /> <VerticalBarChart data={dataBarChart} labels={labelsBarChart} />
</div> </div>
</div> </div>

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

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

Loading…
Cancel
Save