mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Allow line chart to use pointBorderWidth of 0 correctly
This commit is contained in:
parent
0b4123b92c
commit
f7d60c2606
@ -139,11 +139,11 @@ module.exports = function(Chart) {
|
||||
var dataset = this.getDataset();
|
||||
var custom = point.custom || {};
|
||||
|
||||
if (custom.borderWidth) {
|
||||
if (!isNaN(custom.borderWidth)) {
|
||||
borderWidth = custom.borderWidth;
|
||||
} else if (dataset.pointBorderWidth) {
|
||||
} else if (!isNaN(dataset.pointBorderWidth)) {
|
||||
borderWidth = helpers.getValueAtIndexOrDefault(dataset.pointBorderWidth, index, borderWidth);
|
||||
} else if (dataset.borderWidth) {
|
||||
} else if (!isNaN(dataset.borderWidth)) {
|
||||
borderWidth = dataset.borderWidth;
|
||||
}
|
||||
|
||||
|
||||
@ -753,4 +753,23 @@ describe('Line controller tests', function() {
|
||||
expect(point._model.borderWidth).toBe(5.5);
|
||||
expect(point._model.radius).toBe(4.4);
|
||||
});
|
||||
|
||||
it('should allow 0 as a point border width', function() {
|
||||
var chart = window.acquireChart({
|
||||
type: 'line',
|
||||
data: {
|
||||
datasets: [{
|
||||
data: [10, 15, 0, -4],
|
||||
label: 'dataset1',
|
||||
pointBorderWidth: 0
|
||||
}],
|
||||
labels: ['label1', 'label2', 'label3', 'label4']
|
||||
}
|
||||
});
|
||||
|
||||
var meta = chart.getDatasetMeta(0);
|
||||
var point = meta.data[0];
|
||||
|
||||
expect(point._model.borderWidth).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
@ -452,4 +452,21 @@ describe('Radar controller tests', function() {
|
||||
expect(point._model.borderWidth).toBe(5.5);
|
||||
expect(point._model.radius).toBe(4.4);
|
||||
});
|
||||
|
||||
it('should allow pointBorderWidth to be set to 0', function() {
|
||||
var chart = window.acquireChart({
|
||||
type: 'radar',
|
||||
data: {
|
||||
datasets: [{
|
||||
data: [10, 15, 0, 4],
|
||||
pointBorderWidth: 0
|
||||
}],
|
||||
labels: ['label1', 'label2', 'label3', 'label4']
|
||||
}
|
||||
});
|
||||
|
||||
var meta = chart.getDatasetMeta(0);
|
||||
var point = meta.data[0];
|
||||
expect(point._model.borderWidth).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user