Chart.js/test/fixtures/core.layouts/stacked-boxes.js
Jukka Kurkela 47d4b04836
Layout: support box stacking (#9364)
* Layout: support box stacking

* Add stackWeight and sample

* Cleanup, update docs and types

* Avoid div0

* missing semi
2021-07-11 06:23:42 -04:00

107 lines
2.3 KiB
JavaScript

module.exports = {
config: {
type: 'line',
data: {
datasets: [
{data: [{x: 1, y: 1}, {x: 2, y: 2}, {x: 3, y: 3}], borderColor: 'red'},
{data: [{x: 1, y: 1}, {x: 2, y: 2}, {x: 3, y: 3}], yAxisID: 'y1', xAxisID: 'x1', borderColor: 'green'},
{data: [{x: 1, y: 1}, {x: 2, y: 2}, {x: 3, y: 3}], yAxisID: 'y2', xAxisID: 'x2', borderColor: 'blue'},
],
labels: ['tick1', 'tick2', 'tick3']
},
options: {
plugins: false,
scales: {
x: {
type: 'linear',
position: 'bottom',
stack: '1',
offset: true,
bounds: 'data',
grid: {
borderColor: 'red'
},
ticks: {
autoSkip: false,
maxRotation: 0,
count: 3
}
},
x1: {
type: 'linear',
position: 'bottom',
stack: '1',
offset: true,
bounds: 'data',
grid: {
borderColor: 'green'
},
ticks: {
autoSkip: false,
maxRotation: 0,
count: 3
}
},
x2: {
type: 'linear',
position: 'bottom',
stack: '1',
offset: true,
bounds: 'data',
grid: {
borderColor: 'blue'
},
ticks: {
autoSkip: false,
maxRotation: 0,
count: 3
}
},
y: {
type: 'linear',
position: 'left',
stack: '1',
offset: true,
grid: {
borderColor: 'red'
},
ticks: {
precision: 0
}
},
y1: {
type: 'linear',
position: 'left',
stack: '1',
offset: true,
grid: {
borderColor: 'green'
},
ticks: {
precision: 0
}
},
y2: {
type: 'linear',
position: 'left',
stack: '1',
offset: true,
grid: {
borderColor: 'blue'
},
ticks: {
precision: 0
}
}
}
}
},
options: {
spriteText: true,
canvas: {
height: 384,
width: 384
}
}
};