OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Chartjs Barchart without borders

  • Thread starter Thread starter Peet
  • Start date Start date
P

Peet

Guest
I am trying to build a barchart with chartjs where there should be no space between neighbouring bars. The problem i have is that I don't get rid of the borders between the bars: Bars with borders

This is my config:

Code:
new Chart($('#weekly-availabilities-chart'), {
  type: 'bar',
  data: {
  labels: ...,
  datasets: [
    {
      backgroundColor: 'rgba(153, 193, 72, 0.4)',
      label: 'label a',
      borderWidth: 0,
      data: dataset_1
    }, {
      backgroundColor: 'rgba(13, 39, 73, 0.4)',
      label: 'label b',
      borderWidth: 0,
      data: dataset_2
    }
  ]
},
  options: {
  scales: {
    xAxes: [
      {
        barPercentage: 1,
        categoryPercentage: 1,
        gridLines: {
          display: false
        }
      }
    ],
    yAxes: [
      {
        stacked: true,
        gridLines: {
          color: 'rgba(0,0,0,0.05)'
        },
        ticks: {
          beginAtZero: true,
          max: 40
        }
      }
    ]
  }
}
});

<p>I am trying to build a barchart with chartjs where there should be no space between neighbouring bars. The problem i have is that I don't get rid of the borders between the bars:
<a href="https://i.sstatic.net/FurQa.png" rel="nofollow noreferrer">Bars with borders</a></p>

<p>This is my config:</p>

<pre><code>new Chart($('#weekly-availabilities-chart'), {
type: 'bar',
data: {
labels: ...,
datasets: [
{
backgroundColor: 'rgba(153, 193, 72, 0.4)',
label: 'label a',
borderWidth: 0,
data: dataset_1
}, {
backgroundColor: 'rgba(13, 39, 73, 0.4)',
label: 'label b',
borderWidth: 0,
data: dataset_2
}
]
},
options: {
scales: {
xAxes: [
{
barPercentage: 1,
categoryPercentage: 1,
gridLines: {
display: false
}
}
],
yAxes: [
{
stacked: true,
gridLines: {
color: 'rgba(0,0,0,0.05)'
},
ticks: {
beginAtZero: true,
max: 40
}
}
]
}
}
});
</code></pre>
 

Latest posts

M
Replies
0
Views
1
Marcos R. Guevara
M
Top