mirror of
https://git.roussel.pro/telecom-paris/pact.git
synced 2026-02-09 02:20:17 +01:00
48 lines
785 B
JavaScript
48 lines
785 B
JavaScript
import React from 'react'
|
|
import { Bar } from 'react-chartjs-2'
|
|
import Chart from 'chart.js/auto';
|
|
|
|
export default function ComparativeBarChart({ xlabels, data0, label0, data1, label1}) {
|
|
return (
|
|
<Bar
|
|
options={{
|
|
// plugins: {
|
|
// title: {
|
|
// display: true,
|
|
// text: title
|
|
// },
|
|
// },
|
|
responsive: true,
|
|
interaction: {
|
|
intersect: false,
|
|
},
|
|
scales: {
|
|
x: {
|
|
stacked: true,
|
|
},
|
|
y: {
|
|
stacked: true
|
|
}
|
|
}
|
|
}}
|
|
data={{
|
|
labels: xlabels,
|
|
datasets: [
|
|
{
|
|
label: label0,
|
|
data: data0,
|
|
backgroundColor: "#FF3B30",
|
|
stack: "stack0"
|
|
},
|
|
{
|
|
label: label1,
|
|
data: data1,
|
|
backgroundColor: "#0000FF",
|
|
stack: "stack1"
|
|
}
|
|
]
|
|
}}
|
|
/>
|
|
)
|
|
}
|