2015-08-23 23:17:46 +02:00
|
|
|
describe('Linear Scale', function() {
|
2015-09-26 03:04:45 +02:00
|
|
|
it('Should register the constructor with the scale service', function() {
|
|
|
|
var Constructor = Chart.scaleService.getScaleConstructor('linear');
|
|
|
|
expect(Constructor).not.toBe(undefined);
|
|
|
|
expect(typeof Constructor).toBe('function');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Should have the correct default config', function() {
|
|
|
|
var defaultConfig = Chart.scaleService.getScaleDefaults('linear');
|
|
|
|
expect(defaultConfig).toEqual({
|
|
|
|
display: true,
|
|
|
|
|
|
|
|
gridLines: {
|
2016-10-16 23:34:59 +02:00
|
|
|
color: 'rgba(0, 0, 0, 0.1)',
|
2016-05-17 21:11:29 +02:00
|
|
|
drawBorder: true,
|
2015-09-26 03:04:45 +02:00
|
|
|
drawOnChartArea: true,
|
|
|
|
drawTicks: true, // draw ticks extending towards the label
|
2016-04-17 03:49:08 +02:00
|
|
|
tickMarkLength: 10,
|
2015-09-26 03:04:45 +02:00
|
|
|
lineWidth: 1,
|
|
|
|
offsetGridLines: false,
|
2015-11-25 01:18:15 +01:00
|
|
|
display: true,
|
2016-10-16 23:34:59 +02:00
|
|
|
zeroLineColor: 'rgba(0,0,0,0.25)',
|
2015-09-26 03:04:45 +02:00
|
|
|
zeroLineWidth: 1,
|
2017-03-21 11:38:09 +01:00
|
|
|
zeroLineBorderDash: [],
|
|
|
|
zeroLineBorderDashOffset: 0.0,
|
2016-08-12 18:31:54 +02:00
|
|
|
borderDash: [],
|
|
|
|
borderDashOffset: 0.0
|
2015-09-26 03:04:45 +02:00
|
|
|
},
|
2016-10-16 23:34:59 +02:00
|
|
|
position: 'left',
|
2017-08-14 10:09:33 +02:00
|
|
|
offset: false,
|
2017-09-10 19:15:47 +02:00
|
|
|
scaleLabel: Chart.defaults.scale.scaleLabel,
|
2015-09-26 03:04:45 +02:00
|
|
|
ticks: {
|
|
|
|
beginAtZero: false,
|
2016-05-10 13:10:01 +02:00
|
|
|
minRotation: 0,
|
2016-04-17 00:38:03 +02:00
|
|
|
maxRotation: 50,
|
2015-09-26 03:04:45 +02:00
|
|
|
mirror: false,
|
2016-11-05 01:41:54 +01:00
|
|
|
padding: 0,
|
2015-09-26 03:04:45 +02:00
|
|
|
reverse: false,
|
2015-11-25 01:18:15 +01:00
|
|
|
display: true,
|
2015-10-19 01:48:57 +02:00
|
|
|
callback: defaultConfig.ticks.callback, // make this work nicer, then check below
|
2015-12-21 23:47:38 +01:00
|
|
|
autoSkip: true,
|
2016-05-11 11:43:22 +02:00
|
|
|
autoSkipPadding: 0,
|
2017-06-15 13:20:16 +02:00
|
|
|
labelOffset: 0,
|
|
|
|
minor: {},
|
|
|
|
major: {},
|
2015-09-26 03:04:45 +02:00
|
|
|
}
|
2015-08-23 23:17:46 +02:00
|
|
|
});
|
2015-10-19 01:48:57 +02:00
|
|
|
|
|
|
|
expect(defaultConfig.ticks.callback).toEqual(jasmine.any(Function));
|
2015-09-26 03:04:45 +02:00
|
|
|
});
|
2015-08-23 23:17:46 +02:00
|
|
|
|
2015-09-26 03:04:45 +02:00
|
|
|
it('Should correctly determine the max & min data values', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [10, 5, 0, -5, 78, -100]
|
|
|
|
}, {
|
|
|
|
yAxisID: 'yScale1',
|
|
|
|
data: [-1000, 1000],
|
|
|
|
}, {
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [150]
|
|
|
|
}],
|
|
|
|
labels: ['a', 'b', 'c', 'd', 'e', 'f']
|
2015-11-13 15:38:35 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear'
|
|
|
|
}, {
|
|
|
|
id: 'yScale1',
|
|
|
|
type: 'linear'
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2015-08-23 23:17:46 +02:00
|
|
|
});
|
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
expect(chart.scales.yScale0).not.toEqual(undefined); // must construct
|
|
|
|
expect(chart.scales.yScale0.min).toBe(-100);
|
|
|
|
expect(chart.scales.yScale0.max).toBe(150);
|
2015-11-18 00:43:18 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
it('Should correctly determine the max & min of string data values', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: ['10', '5', '0', '-5', '78', '-100']
|
|
|
|
}, {
|
|
|
|
yAxisID: 'yScale1',
|
|
|
|
data: ['-1000', '1000'],
|
|
|
|
}, {
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: ['150']
|
|
|
|
}],
|
|
|
|
labels: ['a', 'b', 'c', 'd', 'e', 'f']
|
2015-11-18 00:43:18 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear'
|
|
|
|
}, {
|
|
|
|
id: 'yScale1',
|
|
|
|
type: 'linear'
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2015-11-18 00:43:18 +01:00
|
|
|
});
|
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
expect(chart.scales.yScale0).not.toEqual(undefined); // must construct
|
|
|
|
expect(chart.scales.yScale0.min).toBe(-100);
|
|
|
|
expect(chart.scales.yScale0.max).toBe(150);
|
2015-09-26 03:04:45 +02:00
|
|
|
});
|
2015-08-23 23:17:46 +02:00
|
|
|
|
2017-04-15 18:37:49 +02:00
|
|
|
it('Should correctly determine the max & min when no values provided and suggested minimum and maximum are set', function() {
|
|
|
|
var chart = window.acquireChart({
|
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: []
|
|
|
|
}],
|
|
|
|
labels: ['a', 'b', 'c', 'd', 'e', 'f']
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear',
|
|
|
|
ticks: {
|
|
|
|
suggestedMin: -10,
|
|
|
|
suggestedMax: 15
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(chart.scales.yScale0).not.toEqual(undefined); // must construct
|
|
|
|
expect(chart.scales.yScale0.min).toBe(-10);
|
|
|
|
expect(chart.scales.yScale0.max).toBe(15);
|
|
|
|
});
|
|
|
|
|
2015-10-08 01:37:53 +02:00
|
|
|
it('Should correctly determine the max & min data values ignoring hidden datasets', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: ['10', '5', '0', '-5', '78', '-100']
|
|
|
|
}, {
|
|
|
|
yAxisID: 'yScale1',
|
|
|
|
data: ['-1000', '1000'],
|
|
|
|
}, {
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: ['150'],
|
|
|
|
hidden: true
|
|
|
|
}],
|
|
|
|
labels: ['a', 'b', 'c', 'd', 'e', 'f']
|
2015-11-13 15:38:35 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear'
|
|
|
|
}, {
|
|
|
|
id: 'yScale1',
|
|
|
|
type: 'linear'
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2015-10-08 01:37:53 +02:00
|
|
|
});
|
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
expect(chart.scales.yScale0).not.toEqual(undefined); // must construct
|
|
|
|
expect(chart.scales.yScale0.min).toBe(-100);
|
|
|
|
expect(chart.scales.yScale0.max).toBe(80);
|
2015-10-08 01:37:53 +02:00
|
|
|
});
|
|
|
|
|
2016-01-23 18:44:55 +01:00
|
|
|
it('Should correctly determine the max & min data values ignoring data that is NaN', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
yAxisID: 'yScale0',
|
2016-09-24 18:19:49 +02:00
|
|
|
data: [null, 90, NaN, undefined, 45, 30, Infinity, -Infinity]
|
2016-04-28 03:19:02 +02:00
|
|
|
}],
|
2016-09-24 18:19:49 +02:00
|
|
|
labels: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
|
2016-01-23 18:44:55 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear'
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2016-01-23 18:44:55 +01:00
|
|
|
});
|
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
expect(chart.scales.yScale0.min).toBe(30);
|
|
|
|
expect(chart.scales.yScale0.max).toBe(90);
|
2016-01-23 18:44:55 +01:00
|
|
|
|
|
|
|
// Scale is now stacked
|
2016-09-06 11:10:44 +02:00
|
|
|
chart.scales.yScale0.options.stacked = true;
|
|
|
|
chart.update();
|
2016-01-23 18:44:55 +01:00
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
expect(chart.scales.yScale0.min).toBe(0);
|
|
|
|
expect(chart.scales.yScale0.max).toBe(90);
|
2016-01-23 18:44:55 +01:00
|
|
|
});
|
|
|
|
|
2015-09-26 03:04:45 +02:00
|
|
|
it('Should correctly determine the max & min for scatter data', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'line',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
xAxisID: 'xScale0',
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [{
|
|
|
|
x: 10,
|
|
|
|
y: 100
|
|
|
|
}, {
|
|
|
|
x: -10,
|
|
|
|
y: 0
|
|
|
|
}, {
|
|
|
|
x: 0,
|
|
|
|
y: 0
|
|
|
|
}, {
|
|
|
|
x: 99,
|
|
|
|
y: 7
|
|
|
|
}]
|
|
|
|
}],
|
2015-11-13 15:38:35 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
id: 'xScale0',
|
|
|
|
type: 'linear',
|
|
|
|
position: 'bottom'
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear'
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2015-08-23 23:17:46 +02:00
|
|
|
});
|
2016-09-06 11:10:44 +02:00
|
|
|
chart.update();
|
2015-08-23 23:17:46 +02:00
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
expect(chart.scales.xScale0.min).toBe(-20);
|
|
|
|
expect(chart.scales.xScale0.max).toBe(100);
|
|
|
|
expect(chart.scales.yScale0.min).toBe(0);
|
|
|
|
expect(chart.scales.yScale0.max).toBe(100);
|
2015-09-26 03:04:45 +02:00
|
|
|
});
|
|
|
|
|
2016-01-23 18:44:55 +01:00
|
|
|
it('Should correctly get the label for the given index', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'line',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
xAxisID: 'xScale0',
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [{
|
|
|
|
x: 10,
|
|
|
|
y: 100
|
|
|
|
}, {
|
|
|
|
x: -10,
|
|
|
|
y: 0
|
|
|
|
}, {
|
|
|
|
x: 0,
|
|
|
|
y: 0
|
|
|
|
}, {
|
|
|
|
x: 99,
|
|
|
|
y: 7
|
|
|
|
}]
|
|
|
|
}],
|
2016-01-23 18:44:55 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
id: 'xScale0',
|
|
|
|
type: 'linear',
|
|
|
|
position: 'bottom'
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear'
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2016-01-23 18:44:55 +01:00
|
|
|
});
|
2016-09-06 11:10:44 +02:00
|
|
|
chart.update();
|
2016-01-23 18:44:55 +01:00
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
expect(chart.scales.yScale0.getLabelForIndex(3, 0)).toBe(7);
|
2016-01-23 18:44:55 +01:00
|
|
|
});
|
|
|
|
|
2015-09-26 03:04:45 +02:00
|
|
|
it('Should correctly determine the min and max data values when stacked mode is turned on', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'line',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [10, 5, 0, -5, 78, -100],
|
|
|
|
type: 'bar'
|
|
|
|
}, {
|
|
|
|
yAxisID: 'yScale1',
|
|
|
|
data: [-1000, 1000],
|
|
|
|
}, {
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [150, 0, 0, -100, -10, 9],
|
|
|
|
type: 'bar'
|
|
|
|
}, {
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [10, 10, 10, 10, 10, 10],
|
|
|
|
type: 'line'
|
|
|
|
}],
|
|
|
|
labels: ['a', 'b', 'c', 'd', 'e', 'f']
|
2015-11-13 15:38:35 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear',
|
|
|
|
stacked: true
|
|
|
|
}, {
|
|
|
|
id: 'yScale1',
|
|
|
|
type: 'linear'
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2015-10-08 01:37:53 +02:00
|
|
|
});
|
2016-09-06 11:10:44 +02:00
|
|
|
chart.update();
|
2015-10-08 01:37:53 +02:00
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
expect(chart.scales.yScale0.min).toBe(-150);
|
|
|
|
expect(chart.scales.yScale0.max).toBe(200);
|
2015-10-08 01:37:53 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
it('Should correctly determine the min and max data values when stacked mode is turned on and there are hidden datasets', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [10, 5, 0, -5, 78, -100],
|
|
|
|
}, {
|
|
|
|
yAxisID: 'yScale1',
|
|
|
|
data: [-1000, 1000],
|
|
|
|
}, {
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [150, 0, 0, -100, -10, 9],
|
|
|
|
}, {
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [10, 20, 30, 40, 50, 60],
|
|
|
|
hidden: true
|
|
|
|
}],
|
|
|
|
labels: ['a', 'b', 'c', 'd', 'e', 'f']
|
2015-11-13 15:38:35 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear',
|
|
|
|
stacked: true
|
|
|
|
}, {
|
|
|
|
id: 'yScale1',
|
|
|
|
type: 'linear'
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2015-09-26 03:04:45 +02:00
|
|
|
});
|
2016-09-06 11:10:44 +02:00
|
|
|
chart.update();
|
2015-09-25 04:08:25 +02:00
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
expect(chart.scales.yScale0.min).toBe(-150);
|
|
|
|
expect(chart.scales.yScale0.max).toBe(200);
|
2015-09-26 03:04:45 +02:00
|
|
|
});
|
|
|
|
|
2016-01-09 15:51:04 +01:00
|
|
|
it('Should correctly determine the min and max data values when stacked mode is turned on there are multiple types of datasets', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
type: 'bar',
|
|
|
|
data: [10, 5, 0, -5, 78, -100]
|
|
|
|
}, {
|
|
|
|
type: 'line',
|
|
|
|
data: [10, 10, 10, 10, 10, 10],
|
|
|
|
}, {
|
|
|
|
type: 'bar',
|
|
|
|
data: [150, 0, 0, -100, -10, 9]
|
|
|
|
}],
|
|
|
|
labels: ['a', 'b', 'c', 'd', 'e', 'f']
|
2016-01-09 15:51:04 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear',
|
|
|
|
stacked: true
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2016-01-09 15:51:04 +01:00
|
|
|
});
|
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
chart.scales.yScale0.determineDataLimits();
|
|
|
|
expect(chart.scales.yScale0.min).toBe(-105);
|
|
|
|
expect(chart.scales.yScale0.max).toBe(160);
|
2016-01-09 15:51:04 +01:00
|
|
|
});
|
|
|
|
|
2015-09-26 03:04:45 +02:00
|
|
|
it('Should ensure that the scale has a max and min that are not equal', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
datasets: [],
|
|
|
|
labels: ['a', 'b', 'c', 'd', 'e', 'f']
|
2015-11-13 15:38:35 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear'
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2015-09-26 03:04:45 +02:00
|
|
|
});
|
2015-09-25 04:08:25 +02:00
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
expect(chart.scales.yScale0).not.toEqual(undefined); // must construct
|
|
|
|
expect(chart.scales.yScale0.min).toBe(-1);
|
|
|
|
expect(chart.scales.yScale0.max).toBe(1);
|
2015-09-26 03:04:45 +02:00
|
|
|
});
|
2015-09-25 04:08:25 +02:00
|
|
|
|
2016-05-07 22:56:04 +02:00
|
|
|
it('Should ensure that the scale has a max and min that are not equal when beginAtZero is set', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-05-07 22:56:04 +02:00
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
datasets: [],
|
|
|
|
labels: ['a', 'b', 'c', 'd', 'e', 'f']
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear',
|
|
|
|
ticks: {
|
|
|
|
beginAtZero: true
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
expect(chart.scales.yScale0).not.toEqual(undefined); // must construct
|
|
|
|
expect(chart.scales.yScale0.min).toBe(0);
|
|
|
|
expect(chart.scales.yScale0.max).toBe(1);
|
2016-05-07 22:56:04 +02:00
|
|
|
});
|
|
|
|
|
2015-10-31 16:40:51 +01:00
|
|
|
it('Should use the suggestedMin and suggestedMax options', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [1, 1, 1, 2, 1, 0]
|
|
|
|
}],
|
|
|
|
labels: ['a', 'b', 'c', 'd', 'e', 'f']
|
2015-11-13 15:38:35 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear',
|
|
|
|
ticks: {
|
|
|
|
suggestedMax: 10,
|
|
|
|
suggestedMin: -10
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2015-10-31 16:40:51 +01:00
|
|
|
});
|
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
expect(chart.scales.yScale0).not.toEqual(undefined); // must construct
|
|
|
|
expect(chart.scales.yScale0.min).toBe(-10);
|
|
|
|
expect(chart.scales.yScale0.max).toBe(10);
|
2015-10-31 16:40:51 +01:00
|
|
|
});
|
|
|
|
|
2015-12-14 08:39:11 +01:00
|
|
|
it('Should use the min and max options', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [1, 1, 1, 2, 1, 0]
|
|
|
|
}],
|
|
|
|
labels: ['a', 'b', 'c', 'd', 'e', 'f']
|
2015-12-14 08:39:11 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear',
|
|
|
|
ticks: {
|
|
|
|
max: 1010,
|
|
|
|
min: -1010
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2015-12-14 08:39:11 +01:00
|
|
|
});
|
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
expect(chart.scales.yScale0).not.toEqual(undefined); // must construct
|
|
|
|
expect(chart.scales.yScale0.min).toBe(-1010);
|
|
|
|
expect(chart.scales.yScale0.max).toBe(1010);
|
|
|
|
expect(chart.scales.yScale0.ticks[0]).toBe('1010');
|
|
|
|
expect(chart.scales.yScale0.ticks[chart.scales.yScale0.ticks.length - 1]).toBe('-1010');
|
2015-12-14 08:39:11 +01:00
|
|
|
});
|
|
|
|
|
2016-10-04 12:53:55 +02:00
|
|
|
it('Should use min, max and stepSize to create fixed spaced ticks', function() {
|
|
|
|
var chart = window.acquireChart({
|
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [10, 3, 6, 8, 3, 1]
|
|
|
|
}],
|
|
|
|
labels: ['a', 'b', 'c', 'd', 'e', 'f']
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear',
|
|
|
|
ticks: {
|
|
|
|
min: 1,
|
|
|
|
max: 11,
|
|
|
|
stepSize: 2
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(chart.scales.yScale0).not.toEqual(undefined); // must construct
|
|
|
|
expect(chart.scales.yScale0.min).toBe(1);
|
|
|
|
expect(chart.scales.yScale0.max).toBe(11);
|
|
|
|
expect(chart.scales.yScale0.ticks).toEqual(['11', '9', '7', '5', '3', '1']);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-09-26 03:04:45 +02:00
|
|
|
it('should forcibly include 0 in the range if the beginAtZero option is used', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [20, 30, 40, 50]
|
|
|
|
}],
|
|
|
|
labels: ['a', 'b', 'c', 'd']
|
2015-11-13 15:38:35 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear',
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2015-08-23 23:17:46 +02:00
|
|
|
});
|
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
expect(chart.scales.yScale0).not.toEqual(undefined); // must construct
|
|
|
|
expect(chart.scales.yScale0.ticks).toEqual(['50', '45', '40', '35', '30', '25', '20']);
|
2015-09-26 03:04:45 +02:00
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
chart.scales.yScale0.options.ticks.beginAtZero = true;
|
|
|
|
chart.update();
|
|
|
|
expect(chart.scales.yScale0.ticks).toEqual(['50', '45', '40', '35', '30', '25', '20', '15', '10', '5', '0']);
|
2015-09-26 03:04:45 +02:00
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
chart.data.datasets[0].data = [-20, -30, -40, -50];
|
|
|
|
chart.update();
|
|
|
|
expect(chart.scales.yScale0.ticks).toEqual(['0', '-5', '-10', '-15', '-20', '-25', '-30', '-35', '-40', '-45', '-50']);
|
2015-09-26 03:04:45 +02:00
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
chart.scales.yScale0.options.ticks.beginAtZero = false;
|
|
|
|
chart.update();
|
|
|
|
expect(chart.scales.yScale0.ticks).toEqual(['-20', '-25', '-30', '-35', '-40', '-45', '-50']);
|
2015-09-26 03:04:45 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
it('Should generate tick marks in the correct order in reversed mode', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [10, 5, 0, 25, 78]
|
|
|
|
}],
|
|
|
|
labels: ['a', 'b', 'c', 'd']
|
2015-11-13 15:38:35 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear',
|
|
|
|
ticks: {
|
|
|
|
reverse: true
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2015-08-23 23:17:46 +02:00
|
|
|
});
|
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
expect(chart.scales.yScale0.ticks).toEqual(['0', '10', '20', '30', '40', '50', '60', '70', '80']);
|
|
|
|
expect(chart.scales.yScale0.start).toBe(80);
|
|
|
|
expect(chart.scales.yScale0.end).toBe(0);
|
2015-09-26 03:04:45 +02:00
|
|
|
});
|
|
|
|
|
2015-10-24 04:00:59 +02:00
|
|
|
it('should use the correct number of decimal places in the default format function', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [0.06, 0.005, 0, 0.025, 0.0078]
|
|
|
|
}],
|
|
|
|
labels: ['a', 'b', 'c', 'd']
|
2015-11-13 15:38:35 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear',
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2015-10-24 04:00:59 +02:00
|
|
|
});
|
2016-09-06 11:10:44 +02:00
|
|
|
expect(chart.scales.yScale0.ticks).toEqual(['0.06', '0.05', '0.04', '0.03', '0.02', '0.01', '0']);
|
2015-10-24 04:00:59 +02:00
|
|
|
});
|
|
|
|
|
2015-09-26 03:04:45 +02:00
|
|
|
it('Should build labels using the user supplied callback', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [10, 5, 0, 25, 78]
|
|
|
|
}],
|
|
|
|
labels: ['a', 'b', 'c', 'd']
|
2015-11-13 15:38:35 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear',
|
|
|
|
ticks: {
|
|
|
|
callback: function(value, index) {
|
|
|
|
return index.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2015-09-01 02:42:29 +02:00
|
|
|
});
|
|
|
|
|
2015-09-26 03:04:45 +02:00
|
|
|
// Just the index
|
2016-09-06 11:10:44 +02:00
|
|
|
expect(chart.scales.yScale0.ticks).toEqual(['0', '1', '2', '3', '4', '5', '6', '7', '8']);
|
2015-09-26 03:04:45 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
it('Should get the correct pixel value for a point', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'line',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
xAxisID: 'xScale0',
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: []
|
|
|
|
}],
|
2015-11-13 15:38:35 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
id: 'xScale0',
|
|
|
|
type: 'linear',
|
|
|
|
position: 'bottom'
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear'
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2015-09-01 02:42:29 +02:00
|
|
|
});
|
2016-05-10 13:10:01 +02:00
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
var xScale = chart.scales.xScale0;
|
2016-04-28 03:19:02 +02:00
|
|
|
expect(xScale.getPixelForValue(1, 0, 0)).toBeCloseToPixel(501); // right - paddingRight
|
2017-09-10 19:15:47 +02:00
|
|
|
expect(xScale.getPixelForValue(-1, 0, 0)).toBeCloseToPixel(31 + 6); // left + paddingLeft + lineSpace
|
|
|
|
expect(xScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(266 + 6 / 2); // halfway*/
|
2016-04-28 03:19:02 +02:00
|
|
|
|
2016-04-30 02:03:15 +02:00
|
|
|
expect(xScale.getValueForPixel(501)).toBeCloseTo(1, 1e-2);
|
2016-11-05 01:41:54 +01:00
|
|
|
expect(xScale.getValueForPixel(31)).toBeCloseTo(-1, 1e-2);
|
|
|
|
expect(xScale.getValueForPixel(266)).toBeCloseTo(0, 1e-2);
|
2015-09-26 03:04:45 +02:00
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
var yScale = chart.scales.yScale0;
|
2016-04-30 02:03:15 +02:00
|
|
|
expect(yScale.getPixelForValue(1, 0, 0)).toBeCloseToPixel(32); // right - paddingRight
|
|
|
|
expect(yScale.getPixelForValue(-1, 0, 0)).toBeCloseToPixel(484); // left + paddingLeft
|
|
|
|
expect(yScale.getPixelForValue(0, 0, 0)).toBeCloseToPixel(258); // halfway*/
|
2015-09-26 03:04:45 +02:00
|
|
|
|
2016-04-30 02:03:15 +02:00
|
|
|
expect(yScale.getValueForPixel(32)).toBe(1);
|
|
|
|
expect(yScale.getValueForPixel(484)).toBe(-1);
|
|
|
|
expect(yScale.getValueForPixel(258)).toBe(0);
|
2015-09-26 03:04:45 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should fit correctly', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-04-28 03:19:02 +02:00
|
|
|
type: 'line',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
xAxisID: 'xScale0',
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [{
|
|
|
|
x: 10,
|
|
|
|
y: 100
|
|
|
|
}, {
|
|
|
|
x: -10,
|
|
|
|
y: 0
|
|
|
|
}, {
|
|
|
|
x: 0,
|
|
|
|
y: 0
|
|
|
|
}, {
|
|
|
|
x: 99,
|
|
|
|
y: 7
|
|
|
|
}]
|
|
|
|
}],
|
2015-11-13 15:38:35 +01:00
|
|
|
},
|
2016-04-28 03:19:02 +02:00
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
id: 'xScale0',
|
|
|
|
type: 'linear',
|
|
|
|
position: 'bottom'
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear'
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
2015-09-01 02:42:29 +02:00
|
|
|
});
|
2015-09-21 01:41:48 +02:00
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
var xScale = chart.scales.xScale0;
|
2016-04-28 03:24:13 +02:00
|
|
|
expect(xScale.paddingTop).toBeCloseToPixel(0);
|
|
|
|
expect(xScale.paddingBottom).toBeCloseToPixel(0);
|
|
|
|
expect(xScale.paddingLeft).toBeCloseToPixel(0);
|
2016-10-25 03:43:52 +02:00
|
|
|
expect(xScale.paddingRight).toBeCloseToPixel(0);
|
2017-09-10 19:15:47 +02:00
|
|
|
expect(xScale.width).toBeCloseToPixel(468 - 6); // minus lineSpace
|
2016-04-28 03:19:02 +02:00
|
|
|
expect(xScale.height).toBeCloseToPixel(28);
|
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
var yScale = chart.scales.yScale0;
|
2016-04-28 03:24:13 +02:00
|
|
|
expect(yScale.paddingTop).toBeCloseToPixel(0);
|
|
|
|
expect(yScale.paddingBottom).toBeCloseToPixel(0);
|
|
|
|
expect(yScale.paddingLeft).toBeCloseToPixel(0);
|
|
|
|
expect(yScale.paddingRight).toBeCloseToPixel(0);
|
2017-09-10 19:15:47 +02:00
|
|
|
expect(yScale.width).toBeCloseToPixel(30 + 6); // plus lineSpace
|
2016-04-28 03:19:02 +02:00
|
|
|
expect(yScale.height).toBeCloseToPixel(452);
|
2015-09-26 03:04:45 +02:00
|
|
|
|
|
|
|
// Extra size when scale label showing
|
2016-04-28 03:19:02 +02:00
|
|
|
xScale.options.scaleLabel.display = true;
|
|
|
|
yScale.options.scaleLabel.display = true;
|
2016-09-06 11:10:44 +02:00
|
|
|
chart.update();
|
2016-04-28 03:19:02 +02:00
|
|
|
|
2016-04-28 03:24:13 +02:00
|
|
|
expect(xScale.paddingTop).toBeCloseToPixel(0);
|
|
|
|
expect(xScale.paddingBottom).toBeCloseToPixel(0);
|
|
|
|
expect(xScale.paddingLeft).toBeCloseToPixel(0);
|
2016-10-25 03:43:52 +02:00
|
|
|
expect(xScale.paddingRight).toBeCloseToPixel(0);
|
2017-09-10 19:15:47 +02:00
|
|
|
expect(xScale.width).toBeCloseToPixel(440);
|
|
|
|
expect(xScale.height).toBeCloseToPixel(50);
|
2016-04-28 03:19:02 +02:00
|
|
|
|
2016-04-28 03:24:13 +02:00
|
|
|
expect(yScale.paddingTop).toBeCloseToPixel(0);
|
|
|
|
expect(yScale.paddingBottom).toBeCloseToPixel(0);
|
|
|
|
expect(yScale.paddingLeft).toBeCloseToPixel(0);
|
|
|
|
expect(yScale.paddingRight).toBeCloseToPixel(0);
|
2017-09-10 19:15:47 +02:00
|
|
|
expect(yScale.width).toBeCloseToPixel(58);
|
|
|
|
expect(yScale.height).toBeCloseToPixel(430);
|
2015-09-26 03:04:45 +02:00
|
|
|
});
|
2016-08-23 02:09:09 +02:00
|
|
|
|
|
|
|
it('should fit correctly when display is turned off', function() {
|
2016-09-06 11:10:44 +02:00
|
|
|
var chart = window.acquireChart({
|
2016-08-23 02:09:09 +02:00
|
|
|
type: 'line',
|
|
|
|
data: {
|
|
|
|
datasets: [{
|
|
|
|
xAxisID: 'xScale0',
|
|
|
|
yAxisID: 'yScale0',
|
|
|
|
data: [{
|
|
|
|
x: 10,
|
|
|
|
y: 100
|
|
|
|
}, {
|
|
|
|
x: -10,
|
|
|
|
y: 0
|
|
|
|
}, {
|
|
|
|
x: 0,
|
|
|
|
y: 0
|
|
|
|
}, {
|
|
|
|
x: 99,
|
|
|
|
y: 7
|
|
|
|
}]
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
id: 'xScale0',
|
|
|
|
type: 'linear',
|
|
|
|
position: 'bottom'
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
id: 'yScale0',
|
|
|
|
type: 'linear',
|
|
|
|
gridLines: {
|
|
|
|
drawTicks: false,
|
|
|
|
drawBorder: false
|
|
|
|
},
|
|
|
|
scaleLabel: {
|
2017-07-20 19:20:54 +02:00
|
|
|
display: false,
|
|
|
|
lineHeight: 1.2
|
2016-08-23 02:09:09 +02:00
|
|
|
},
|
|
|
|
ticks: {
|
|
|
|
display: false,
|
|
|
|
padding: 0
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-09-06 11:10:44 +02:00
|
|
|
var yScale = chart.scales.yScale0;
|
2016-08-23 02:09:09 +02:00
|
|
|
expect(yScale.width).toBeCloseToPixel(0);
|
|
|
|
});
|
2017-01-13 17:39:03 +01:00
|
|
|
|
|
|
|
it('max and min value should be valid and finite when charts datasets are hidden', function() {
|
|
|
|
var barData = {
|
|
|
|
labels: ['S1', 'S2', 'S3'],
|
|
|
|
datasets: [{
|
|
|
|
label: 'Closed',
|
|
|
|
backgroundColor: '#382765',
|
|
|
|
data: [2500, 2000, 1500]
|
|
|
|
}, {
|
|
|
|
label: 'In Progress',
|
|
|
|
backgroundColor: '#7BC225',
|
|
|
|
data: [1000, 2000, 1500]
|
|
|
|
}, {
|
|
|
|
label: 'Assigned',
|
|
|
|
backgroundColor: '#ffC225',
|
|
|
|
data: [1000, 2000, 1500]
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
|
|
|
|
var chart = window.acquireChart({
|
|
|
|
type: 'horizontalBar',
|
|
|
|
data: barData,
|
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
stacked: true
|
|
|
|
}],
|
|
|
|
yAxes: [{
|
|
|
|
stacked: true
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
barData.datasets.forEach(function(data, index) {
|
|
|
|
var meta = chart.getDatasetMeta(index);
|
|
|
|
meta.hidden = true;
|
|
|
|
chart.update();
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(chart.scales['x-axis-0'].min).toEqual(0);
|
|
|
|
expect(chart.scales['x-axis-0'].max).toEqual(1);
|
|
|
|
});
|
2017-06-25 15:06:22 +02:00
|
|
|
|
|
|
|
it('max and min value should be valid when min is set and all datasets are hidden', function() {
|
|
|
|
var barData = {
|
|
|
|
labels: ['S1', 'S2', 'S3'],
|
|
|
|
datasets: [{
|
|
|
|
label: 'dataset 1',
|
|
|
|
backgroundColor: '#382765',
|
|
|
|
data: [2500, 2000, 1500],
|
|
|
|
hidden: true,
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
|
|
|
|
var chart = window.acquireChart({
|
|
|
|
type: 'horizontalBar',
|
|
|
|
data: barData,
|
|
|
|
options: {
|
|
|
|
scales: {
|
|
|
|
xAxes: [{
|
|
|
|
ticks: {
|
|
|
|
min: 20
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(chart.scales['x-axis-0'].min).toEqual(20);
|
|
|
|
expect(chart.scales['x-axis-0'].max).toEqual(21);
|
|
|
|
});
|
2016-04-17 00:38:03 +02:00
|
|
|
});
|