score:11

Accepted answer

 const options = {
       scales: {
            xaxes: [{
                stacked: true
            }],
            yaxes: [{
                stacked: true
            }]
        }
    }

    let data ={ 
      datasets:[{
        label: 'test1',
          data :[1]
        },
        {
          label: 'test2',
          data:  [2]   
        }],
      labels:['label']
    }
    
    render(){
      return  <bar  data={data} options={options} />
    }

score:10

add the stack option to your datasets.

identical stack values are stacked together.

const arbitrarystackkey = "stack1";
const data = {
  labels: ['a', 'b', 'c', 'd', 'e'],
  datasets: [
    // these two will be in the same stack.
    {
      stack: arbitrarystackkey,
      label: 'data1',
      data: [1, 2, 3, 4, 5]
    },
    {
      stack: arbitrarystackkey,
      label: 'data2',
      data: [5, 4, 3, 2, 1]   
    }
  ]
}

Related Query

More Query from same tag