Commit 198d16f7 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Fix sub y extent when default extent set

parent 81b8d10d
......@@ -534,8 +534,10 @@
yForText = $$.generateXYForText(areaIndices, barIndices, lineIndices, false);
// Update sub domain
$$.subY.domain($$.y.domain());
$$.subY2.domain($$.y2.domain());
if (withY) {
$$.subY.domain($$.getYDomain(targetsToShow, 'y'));
$$.subY2.domain($$.getYDomain(targetsToShow, 'y2'));
}
// tooltip
$$.tooltip.style("display", "none");
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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]);
});
});
});
......@@ -529,8 +529,10 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
yForText = $$.generateXYForText(areaIndices, barIndices, lineIndices, false);
// Update sub domain
$$.subY.domain($$.y.domain());
$$.subY2.domain($$.y2.domain());
if (withY) {
$$.subY.domain($$.getYDomain(targetsToShow, 'y'));
$$.subY2.domain($$.getYDomain(targetsToShow, 'y2'));
}
// tooltip
$$.tooltip.style("display", "none");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment