Bar chart is drawing weird border on bottom #11133
Answered
by
CatNipQueen
CatNipQueen
asked this question in
Q&A
-
I have a strange problem that a border is drawn at the bottom of my chart: However, if I add a negative value to the data, the border disappears: const chartConfig: ChartConfiguration<"bar"> = {
data: {
labels,
datasets: [
{
data: labels,
backgroundColor: (context: ScriptableContext<"bar">) => {
const ctx = context.chart.ctx;
const chartArea = context.chart.chartArea;
const gradient = ctx.createLinearGradient(
0,
chartArea.bottom,
0,
chartArea.top
);
gradient.addColorStop(1, "rgba(79,43,148,1)");
gradient.addColorStop(0, "rgba(79,43,148,0.32)");
return gradient;
},
borderColor: "#C890FF",
borderWidth: { top: 2, bottom: 0 },
},
],
},
options: {
responsive: true,
maintainAspectRatio: false,
layout: {
padding: {
left: -10,
},
},
scales: {
x: {
grid: {
display: false,
},
ticks: {
display: false,
},
},
y: {
position: "right",
grid: {
color: "#313131",
},
border: {
display: false,
},
},
},
},
type: "bar",
}; |
Beta Was this translation helpful? Give feedback.
Answered by
CatNipQueen
Feb 11, 2023
Replies: 1 comment
-
It's only happening in Safari. Those I will mark as answered. Not sure if a bug in chartjs or Safari. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
CatNipQueen
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's only happening in Safari. Those I will mark as answered. Not sure if a bug in chartjs or Safari.