mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 12:19:08 +02:00
Support an array for line chart pointBorderWidth
This commit is contained in:
parent
225bfd36f3
commit
cc9e88aebc
@ -137,7 +137,7 @@ module.exports = function(Chart) {
|
||||
|
||||
if (!isNaN(custom.borderWidth)) {
|
||||
borderWidth = custom.borderWidth;
|
||||
} else if (!isNaN(dataset.pointBorderWidth)) {
|
||||
} else if (!isNaN(dataset.pointBorderWidth) || helpers.isArray(dataset.pointBorderWidth)) {
|
||||
borderWidth = helpers.valueAtIndexOrDefault(dataset.pointBorderWidth, index, borderWidth);
|
||||
} else if (!isNaN(dataset.borderWidth)) {
|
||||
borderWidth = dataset.borderWidth;
|
||||
|
@ -730,4 +730,24 @@ describe('Line controller tests', function() {
|
||||
|
||||
expect(point._model.borderWidth).toBe(0);
|
||||
});
|
||||
|
||||
it('should allow an array as the point border width setting', function() {
|
||||
var chart = window.acquireChart({
|
||||
type: 'line',
|
||||
data: {
|
||||
datasets: [{
|
||||
data: [10, 15, 0, -4],
|
||||
label: 'dataset1',
|
||||
pointBorderWidth: [1, 2, 3, 4]
|
||||
}],
|
||||
labels: ['label1', 'label2', 'label3', 'label4']
|
||||
}
|
||||
});
|
||||
|
||||
var meta = chart.getDatasetMeta(0);
|
||||
expect(meta.data[0]._model.borderWidth).toBe(1);
|
||||
expect(meta.data[1]._model.borderWidth).toBe(2);
|
||||
expect(meta.data[2]._model.borderWidth).toBe(3);
|
||||
expect(meta.data[3]._model.borderWidth).toBe(4);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user