diff --git a/test/fixtures/controller.doughnut/borderAlign/indexable.js b/test/fixtures/controller.doughnut/borderAlign/indexable.js new file mode 100644 index 00000000000..dd7798ed486 --- /dev/null +++ b/test/fixtures/controller.doughnut/borderAlign/indexable.js @@ -0,0 +1,52 @@ +module.exports = { + config: { + type: 'doughnut', + data: { + labels: [0, 1, 2, 3, 4, 5], + datasets: [ + { + // option in dataset + data: [0, 2, 4, null, 6, 8], + borderAlign: [ + 'center', + 'inner', + 'center', + 'inner', + 'center', + 'inner', + ], + borderColor: '#00ff00' + }, + { + // option in element (fallback) + data: [0, 2, 4, null, 6, 8], + } + ] + }, + options: { + legend: false, + title: false, + elements: { + arc: { + backgroundColor: 'transparent', + borderColor: '#ff0000', + borderWidth: 5, + borderAlign: [ + 'center', + 'inner', + 'center', + 'inner', + 'center', + 'inner', + ] + } + }, + } + }, + options: { + canvas: { + height: 256, + width: 512 + } + } +}; diff --git a/test/fixtures/controller.doughnut/borderAlign/indexable.png b/test/fixtures/controller.doughnut/borderAlign/indexable.png new file mode 100644 index 00000000000..4043b051e76 Binary files /dev/null and b/test/fixtures/controller.doughnut/borderAlign/indexable.png differ diff --git a/test/fixtures/controller.doughnut/borderAlign/scriptable.js b/test/fixtures/controller.doughnut/borderAlign/scriptable.js new file mode 100644 index 00000000000..29582d12b5f --- /dev/null +++ b/test/fixtures/controller.doughnut/borderAlign/scriptable.js @@ -0,0 +1,44 @@ +module.exports = { + config: { + type: 'doughnut', + data: { + labels: [0, 1, 2, 3, 4, 5], + datasets: [ + { + // option in dataset + data: [0, 2, 4, null, 6, 8], + borderAlign: function(ctx) { + var value = ctx.dataset.data[ctx.dataIndex] || 0; + return value > 4 ? 'inner' : 'center'; + }, + borderColor: '#0000ff', + }, + { + // option in element (fallback) + data: [0, 2, 4, null, 6, 8], + } + ] + }, + options: { + legend: false, + title: false, + elements: { + arc: { + backgroundColor: 'transparent', + borderColor: '#ff00ff', + borderWidth: 8, + borderAlign: function(ctx) { + var value = ctx.dataset.data[ctx.dataIndex] || 0; + return value > 4 ? 'center' : 'inner'; + } + } + }, + } + }, + options: { + canvas: { + height: 256, + width: 512 + } + } +}; diff --git a/test/fixtures/controller.doughnut/borderAlign/scriptable.png b/test/fixtures/controller.doughnut/borderAlign/scriptable.png new file mode 100644 index 00000000000..ed0030928e5 Binary files /dev/null and b/test/fixtures/controller.doughnut/borderAlign/scriptable.png differ diff --git a/test/fixtures/controller.doughnut/borderAlign/value.js b/test/fixtures/controller.doughnut/borderAlign/value.js new file mode 100644 index 00000000000..6a3d5334e50 --- /dev/null +++ b/test/fixtures/controller.doughnut/borderAlign/value.js @@ -0,0 +1,38 @@ +module.exports = { + config: { + type: 'doughnut', + data: { + labels: [0, 1, 2, 3, 4, 5], + datasets: [ + { + // option in dataset + data: [0, 2, 4, null, 6, 8], + borderAlign: 'inner', + borderColor: '#00ff00', + }, + { + // option in element (fallback) + data: [0, 2, 4, null, 6, 8], + } + ] + }, + options: { + legend: false, + title: false, + elements: { + arc: { + backgroundColor: 'transparent', + borderAlign: 'center', + borderColor: '#0000ff', + borderWidth: 4, + } + }, + } + }, + options: { + canvas: { + height: 256, + width: 512 + } + } +}; diff --git a/test/fixtures/controller.doughnut/borderAlign/value.png b/test/fixtures/controller.doughnut/borderAlign/value.png new file mode 100644 index 00000000000..0d7b25355cf Binary files /dev/null and b/test/fixtures/controller.doughnut/borderAlign/value.png differ