I'm using ApexChart for a project, and I want to set different colors for each bar. I pass the data array and the color array to the component, based on the color array index the relevant data bar should be colored.
Current implementation as below, I tired colors: method but it only gets the first color of the color array.
const options: ApexOptions = {
chart: {
height: 200,
type: 'bar',
offsetY: 16,
toolbar: {
show: false,
},
},
plotOptions: {
bar: {
horizontal: true,
barHeight: '85%',
},
},
dataLabels: {
enabled: false,
},
xaxis: {
position: 'top',
},
yaxis: {
show: false,
},
grid: {
padding: {
top: 0,
right: 0,
bottom: 0,
left: 0
},
},
};
const series = [
{
data: exampleChartData.data || [],
}
];
return (
<Chart
options={options}
series={series}
type="bar"
height={740}
className="apex-charts"
dir="ltr"
/>
);