2017-05-24 105 views
0

我正在嘗試用chartjs建立一個條形圖,在相鄰的酒吧之間應該沒有空間。我的問題是,我不擺脫邊界條之間: Bars with bordersChartjs無邊界條形圖

這是我的配置:在你的數據集

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 
     } 
     } 
    ] 
    } 
} 
}); 
+0

檢查此https://jsfiddle.net/07pzys9t/2/ –

回答

0

使用borderWidth: 0

datasets: [ 
    { 
    backgroundColor: 'rgba(153, 193, 72, 0.4)', 
    label: 'label a', 
    data: dataset_1, 
    borderWidth: 0 
    }, { 
    backgroundColor: 'rgba(13, 39, 73, 0.4)', 
    label: 'label b', 
    data: dataset_2, 
    borderWidth: 0 
    } 
] 
+1

我試過了,但它沒有任何影響。我會更新我的問題,包括這個選項。 – Peet

+0

您是否找到解決方案? –