mirror of https://github.com/masayuki0812/c3.git
Quite good looking graph derived from d3.js
http://c3js.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.5 KiB
56 lines
1.5 KiB
10 years ago
|
var describe = window.describe,
|
||
|
expect = window.expect,
|
||
|
it = window.it,
|
||
|
beforeEach = window.beforeEach;
|
||
|
|
||
|
describe('c3 chart zoom', function () {
|
||
|
'use strict';
|
||
|
|
||
|
var chart, d3;
|
||
|
|
||
|
var args = {
|
||
|
data: {
|
||
|
columns: [
|
||
|
['data1', 30, 200, 100, 400, 3150, 250],
|
||
|
['data2', 50, 20, 10, 40, 15, 6025]
|
||
|
]
|
||
|
},
|
||
|
axis: {
|
||
|
x: {
|
||
|
extent: [1, 2]
|
||
|
}
|
||
|
},
|
||
|
zoom: {
|
||
|
enable: true
|
||
|
},
|
||
|
subchart: {
|
||
|
show: true
|
||
|
}
|
||
|
};
|
||
|
|
||
|
beforeEach(function (done) {
|
||
|
chart = window.initChart(chart, args, done);
|
||
|
d3 = chart.internal.d3;
|
||
|
});
|
||
|
|
||
|
describe('default extent', function () {
|
||
|
|
||
|
it('should have default extent', function () {
|
||
|
var yDomain = chart.internal.y.domain(),
|
||
|
subYDomain = chart.internal.subY.domain(),
|
||
|
brushExtent = chart.internal.brush.extent(),
|
||
|
expectedYDomain = [-9, 219],
|
||
|
expectedSubYDomain = [-591.5, 6626.5],
|
||
|
expectedBrushExtent = [1, 2];
|
||
|
expect(yDomain[0]).toBe(expectedYDomain[0]);
|
||
|
expect(yDomain[1]).toBe(expectedYDomain[1]);
|
||
|
expect(subYDomain[0]).toBe(expectedSubYDomain[0]);
|
||
|
expect(subYDomain[1]).toBe(expectedSubYDomain[1]);
|
||
|
expect(brushExtent[0]).toBe(expectedBrushExtent[0]);
|
||
|
expect(brushExtent[1]).toBe(expectedBrushExtent[1]);
|
||
|
});
|
||
|
|
||
|
});
|
||
|
|
||
|
});
|