提交 2b6243a2 编写于 作者: K kener

dataRange scatter mix~

上级 d2783c9f
......@@ -224,6 +224,11 @@
</div>
<div class="row-fluid">
<div class="span12">
<div class="span4">
<a href="example/mix4.html"><img src="asset/img/example/mix4.png"></a>
<p>折线图与散点图混合(使用时需要注意同步数值轴与类目轴坐标)</p>
<p><a class="btn" href="example/mix4.html">View details &raquo;</a></p>
</div><!--/span-->
<div class="span4">
<a href="example/lasagna.html"><img src="asset/img/example/lasagna.png"></a>
<p>多层嵌套环形图。</p>
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ECharts</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="ECharts">
<meta name="author" content="linzhifeng@baidu.com">
<script src="../asset/js/esl/esl.js"></script>
<script src="../asset/js/codemirror.js"></script>
<script src="../asset/js/javascript.js"></script>
<link href="../asset/css/bootstrap.css" rel="stylesheet">
<link href="../asset/css/bootstrap-responsive.css" rel="stylesheet">
<link href="../asset/css/codemirror.css" rel="stylesheet">
<link href="../asset/css/monokai.css" rel="stylesheet">
<link href="../asset/css/echartsHome.css" rel="stylesheet">
<link rel="shortcut icon" href="../asset/ico/favicon.png">
</head>
<body>
<!-- NAVBAR
================================================== -->
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="../../index.html">ECharts</a>
<div class="nav-collapse collapse">
<a id="forkme_banner" href="https://github.com/ecomfe/echarts">View on GitHub</a>
<ul class="nav">
<li><a href="../../index.html"><i class="icon-home icon-white"></i> Home</a></li>
<li class="active"><a href="../example.html" class="active">Example</a></li>
<li><a href="../doc.html" >API &amp; Doc</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-download-alt icon-white"></i>Download <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="https://github.com/ecomfe/echarts/archive/1.0.0.zip">ZIP (1.0.0)</a></li>
<li><a href="https://github.com/ecomfe/echarts/archive/master.zip">ZIP (Latest)</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Link <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="https://github.com/ecomfe" target="_blank">Ecom-FE</a></li>
<li><a href="http://fe.baidu.com/doc/ecom/tech/topic/dv/index.html" target="_blank">Data Visualization</a></li>
<li class="divider"></li>
<!--li class="nav-header">Library</li-->
<li><a href="http://ecomfe.github.io/zrender/index.html" target="_blank">ZRender</a></li>
<li><a href="http://tangram.baidu.com/" target="_blank">Tangram</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div><!-- /.container -->
</div><!-- /.navbar-inner -->
</div><!-- /.navbar-wrapper -->
<div class="container-fluid">
<div class="row-fluid">
<div id="sidebar-code" class="span4">
<div class="well sidebar-nav">
<div class="nav-header"><a href="#" onclick="autoResize()" class="icon-resize-full" id ="icon-resize" ></a>option</div>
<textarea id="code" name="code">
option = {
tooltip : {
trigger: 'item'
},
toolbox: {
show : true,
feature : {
mark : true,
dataZoom: true,
dataView : {readOnly: false},
restore : true
}
},
dataRange: {
min: 0,
max: 100,
y: 'center',
text:['高','低'], // 文本,默认为数值文本
color:['skyblue','lightgreen'],
calculable : true
},
xAxis : [
{
type : 'value',
power : 1,
scale : true
}
],
yAxis : [
{
type : 'value',
position:'right',
power : 1,
scale : true,
splitArea : {show : true}
}
],
animation: false,
series : [
{
name:'scatter1',
type:'scatter',
symbolSize: function(value){
return Math.round(value[2] / 10);
},
data: (function() {
var d = [];
var len = 500;
var value;
while (len--) {
value = (Math.random()*100).toFixed(2) - 0;
d.push([
(Math.random()*value + value).toFixed(2) - 0,
(Math.random()*value).toFixed(2) - 0,
value
]);
}
return d;
})()
}
]
};
</textarea>
</div><!--/.well -->
</div><!--/span-->
<div id="graphic" class="span8">
<div id="main" class="main"></div>
<div>
<button onclick="refresh(true)">Refresh ~</button>
<span id='wrong-message' style="color:red"></span>
</div>
</div><!--/span-->
</div><!--/row-->
<hr>
<!-- FOOTER -->
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>&copy; 2013 Ecom-FE. &middot; <a href="#">Privacy</a> &middot; <a href="#">Terms</a></p>
</footer>
</div><!--/.fluid-container-->
<script src="../asset/js/jquery.js"></script>
<script src="../asset/js/bootstrap-transition.js"></script>
<script src="../asset/js/bootstrap-alert.js"></script>
<script src="../asset/js/bootstrap-modal.js"></script>
<script src="../asset/js/bootstrap-dropdown.js"></script>
<script src="../asset/js/bootstrap-scrollspy.js"></script>
<script src="../asset/js/bootstrap-tab.js"></script>
<script src="../asset/js/bootstrap-tooltip.js"></script>
<script src="../asset/js/bootstrap-popover.js"></script>
<script src="../asset/js/bootstrap-button.js"></script>
<script src="../asset/js/bootstrap-collapse.js"></script>
<script src="../asset/js/bootstrap-carousel.js"></script>
<script src="../asset/js/bootstrap-typeahead.js"></script>
<script src="../asset/js/echartsExample.js"></script>
</body>
</html>
\ No newline at end of file
......@@ -75,6 +75,7 @@ option = {
show : true,
feature : {
mark : true,
dataZoom : true,
dataView : true,
magicType:['line', 'bar'],
restore : true
......
......@@ -87,6 +87,7 @@ option = {
show : true,
feature : {
mark : true,
dataZoom : true,
dataView : {readOnly: false},
restore : true
}
......
......@@ -87,6 +87,7 @@ option = {
show : true,
feature : {
mark : true,
dataZoom : true,
dataView : {readOnly: false},
restore : true
}
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ECharts</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="ECharts">
<meta name="author" content="linzhifeng@baidu.com">
<script src="../asset/js/esl/esl.js"></script>
<script src="../asset/js/codemirror.js"></script>
<script src="../asset/js/javascript.js"></script>
<link href="../asset/css/bootstrap.css" rel="stylesheet">
<link href="../asset/css/bootstrap-responsive.css" rel="stylesheet">
<link href="../asset/css/codemirror.css" rel="stylesheet">
<link href="../asset/css/monokai.css" rel="stylesheet">
<link href="../asset/css/echartsHome.css" rel="stylesheet">
<link rel="shortcut icon" href="../asset/ico/favicon.png">
</head>
<body>
<!-- NAVBAR
================================================== -->
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="../../index.html">ECharts</a>
<div class="nav-collapse collapse">
<a id="forkme_banner" href="https://github.com/ecomfe/echarts">View on GitHub</a>
<ul class="nav">
<li><a href="../../index.html"><i class="icon-home icon-white"></i> Home</a></li>
<li class="active"><a href="../example.html" class="active">Example</a></li>
<li><a href="../doc.html" >API &amp; Doc</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-download-alt icon-white"></i>Download <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="https://github.com/ecomfe/echarts/archive/1.0.0.zip">ZIP (1.0.0)</a></li>
<li><a href="https://github.com/ecomfe/echarts/archive/master.zip">ZIP (Latest)</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Link <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="https://github.com/ecomfe" target="_blank">Ecom-FE</a></li>
<li><a href="http://fe.baidu.com/doc/ecom/tech/topic/dv/index.html" target="_blank">Data Visualization</a></li>
<li class="divider"></li>
<!--li class="nav-header">Library</li-->
<li><a href="http://ecomfe.github.io/zrender/index.html" target="_blank">ZRender</a></li>
<li><a href="http://tangram.baidu.com/" target="_blank">Tangram</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div><!-- /.container -->
</div><!-- /.navbar-inner -->
</div><!-- /.navbar-wrapper -->
<div class="container-fluid">
<div class="row-fluid">
<div id="sidebar-code" class="span4">
<div class="well sidebar-nav">
<div class="nav-header"><a href="#" onclick="autoResize()" class="icon-resize-full" id ="icon-resize" ></a>option</div>
<textarea id="code" name="code">
option = {
tooltip : {
trigger: 'axis'
},
toolbox: {
show : true,
feature : {
mark : true,
dataView : {readOnly: false},
restore : true
}
},
dataRange: {
min: 0,
max: 100,
orient: 'horizontal',
y: 'top',
//text:['高','低'], // 文本,默认为数值文本
color:['lightgreen','yellow'],
splitNumber: 5
},
xAxis : [
{
type : 'category',
boundaryGap : false,
data : function(){
var list = [];
for (var i = 1; i <= 30; i++) {
list.push('2013-03-' + i);
}
return list;
}()
},
{
type : 'value',
scale : true,
splitNumber: 29,
axisLabel: {show:false},
splitLine: {show:false}
}
],
yAxis : [
{
type : 'value',
splitArea : {show : true}
},
{
type : 'value'
}
],
animation: false,
series : [
{
name:'散点',
type:'scatter',
tooltip : {
trigger: 'item',
formatter : function(value) {
return '2013-03-' + value[2][0] + '<br/>'
+ value[0] + ' : '
+ value[2][1] + ', '
+ value[2][2];
}
},
yAxisIndex:1,
xAxisIndex:1,
symbol: 'circle',
symbolSize: function(value){
return Math.round(value[2]/10);
},
data: (function() {
var d = [];
var len = 200;
var value;
while (len--) {
d.push([
Math.round(Math.random()*29) + 1,
(Math.random()*30).toFixed(2) - 0,
(Math.random()*100).toFixed(2) - 0
]);
}
return d;
})()
},
{
name:'折线',
type:'line',
data:function(){
var list = [];
for (var i = 1; i <= 30; i++) {
list.push(Math.round(Math.random()* 30));
}
return list;
}()
}
]
};
</textarea>
</div><!--/.well -->
</div><!--/span-->
<div id="graphic" class="span8">
<div id="main" class="main"></div>
<div>
<button onclick="refresh(true)">Refresh ~</button>
<span id='wrong-message' style="color:red"></span>
</div>
</div><!--/span-->
</div><!--/row-->
<hr>
<!-- FOOTER -->
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>&copy; 2013 Ecom-FE. &middot; <a href="#">Privacy</a> &middot; <a href="#">Terms</a></p>
</footer>
</div><!--/.fluid-container-->
<script src="../asset/js/jquery.js"></script>
<script src="../asset/js/bootstrap-transition.js"></script>
<script src="../asset/js/bootstrap-alert.js"></script>
<script src="../asset/js/bootstrap-modal.js"></script>
<script src="../asset/js/bootstrap-dropdown.js"></script>
<script src="../asset/js/bootstrap-scrollspy.js"></script>
<script src="../asset/js/bootstrap-tab.js"></script>
<script src="../asset/js/bootstrap-tooltip.js"></script>
<script src="../asset/js/bootstrap-popover.js"></script>
<script src="../asset/js/bootstrap-button.js"></script>
<script src="../asset/js/bootstrap-collapse.js"></script>
<script src="../asset/js/bootstrap-carousel.js"></script>
<script src="../asset/js/bootstrap-typeahead.js"></script>
<script src="../asset/js/echartsExample.js"></script>
</body>
</html>
\ No newline at end of file
......@@ -69,7 +69,12 @@
<textarea id="code" name="code">
option = {
tooltip : {
trigger: 'item'
trigger: 'item',
formatter : function(value) {
return value[0] + ' :<br/>'
+ value[2][0] + 'cm '
+ value[2][1] + 'kg ';
}
},
legend: {
data:['女性','男性']
......@@ -83,7 +88,6 @@ option = {
restore : true
}
},
calculable : true,
xAxis : [
{
type : 'value',
......
......@@ -78,19 +78,23 @@ option = {
show : true,
feature : {
mark : true,
dataZoom : true,
dataView : {readOnly: false},
restore : true
}
},
calculable : true,
xAxis : [
{
type : 'value'
type : 'value',
power: 1,
scale: true
}
],
yAxis : [
{
type : 'value',
power: 1,
scale: true,
splitArea : {show : true}
}
],
......@@ -99,16 +103,16 @@ option = {
name:'scatter1',
type:'scatter',
symbolSize: function(value){
return Math.round(value[2] * 3);
return Math.round(value[2] / 5);
},
data: (function() {
var d = [];
var len = 20;
var len = 100;
while (len--) {
d.push([
(Math.random()*10).toFixed(2) - 0,
(Math.random()*10).toFixed(2) - 0,
(Math.random()*10).toFixed(2) - 0
(Math.random()*100).toFixed(2) - 0,
(Math.random()*100).toFixed(2) - 0,
(Math.random()*100).toFixed(2) - 0
]);
}
return d;
......@@ -118,16 +122,16 @@ option = {
name:'scatter2',
type:'scatter',
symbolSize: function(value){
return Math.round(value[2] * 3);
return Math.round(value[2] / 5);
},
data: (function() {
var d = [];
var len = 20;
var len = 100;
while (len--) {
d.push([
(Math.random()*10).toFixed(2) - 0,
(Math.random()*10).toFixed(2) - 0,
(Math.random()*10).toFixed(2) - 0
(Math.random()*100).toFixed(2) - 0,
(Math.random()*100).toFixed(2) - 0,
(Math.random()*100).toFixed(2) - 0
]);
}
return d;
......
......@@ -83,7 +83,6 @@ option = {
restore : true
}
},
calculable : true,
xAxis : [
{
type : 'value',
......@@ -111,11 +110,11 @@ option = {
var len = 15000;
var x = 0;
while (len--) {
x = Math.random() * 10;
x = (Math.random() * 10).toFixed(3) - 0;
d.push([
x,
//Math.random() * 10
Math.sin(x).toFixed(2) - x * (len % 2 ? 0.1 : -0.1) * Math.random()
(Math.sin(x) - x * (len % 2 ? 0.1 : -0.1) * Math.random()).toFixed(3) - 0
]);
}
//console.log(d)
......@@ -131,11 +130,11 @@ option = {
var len = 15000;
var x = 0;
while (len--) {
x = Math.random() * 10;
x = (Math.random() * 10).toFixed(3) - 0;
d.push([
x,
//Math.random() * 10
Math.cos(x).toFixed(2) - x * (len % 2 ? 0.1 : -0.1) * Math.random()
(Math.cos(x) - x * (len % 2 ? 0.1 : -0.1) * Math.random()).toFixed(3) - 0
]);
}
//console.log(d)
......
......@@ -151,6 +151,8 @@ define(function(require) {
* 生成折线和折线上的拐点
*/
function _buildPointList(pointList) {
var dataRange = component.dataRange;
var rangColor; // 更高优先级
var nColor; // normal
var nLineWidth;
var eColor; // emphasis
......@@ -201,6 +203,20 @@ define(function(require) {
for (var i = 0, l = seriesPL.length; i < l; i++) {
singlePoint = seriesPL[i];
data = serie.data[singlePoint[4]];
if (dataRange) {
if (isNaN(data[2])) {
continue;
}
rangColor = dataRange.getColor(data[2]);
if (!rangColor) {
continue;
}
}
else {
rangColor = nColor;
}
queryTarget = [data];
self.shapeList.push(_getSymbol(
seriesIndex, // seriesIndex
......@@ -220,7 +236,7 @@ define(function(require) {
// 填充颜色
self.deepQuery(queryTarget, 'itemStyle.normal.color')
|| nColor,
|| rangColor,
// 线宽
self.deepQuery(
queryTarget, 'itemStyle.normal.lineStyle.width'
......@@ -343,6 +359,19 @@ define(function(require) {
self.clear();
_buildShape();
}
/**
* 值域响应
* @param {Object} param
* @param {Object} status
*/
function ondataRange(param, status) {
if (component.dataRange) {
refresh();
status.needRefresh = true;
}
return;
}
/**
* 动画设定
......@@ -376,6 +405,7 @@ define(function(require) {
self.init = init;
self.refresh = refresh;
self.ondataRange = ondataRange;
self.animation = animation;
init(option, component);
......
......@@ -1046,7 +1046,7 @@ define(function (require) {
_gap = Math.round(
(dataRangeOption.max - dataRangeOption.min)
/ splitNumber
);
) || 1;
} else {
_gap = (dataRangeOption.max - dataRangeOption.min)
/ splitNumber;
......
......@@ -187,13 +187,23 @@ define(function (require) {
else {
itemName = '';
}
if (series[i].type == ecConfig.CHART_TYPE_SCATTER) {
data = typeof data.value != 'undefined'
? data.value
: data;
data = data.join(', ');
}
valueList.push(
itemName
+ (typeof data.value != 'undefined' ? data.value : data)
);
}
content += (series[i].name || '-') + ' : \n';
content += valueList.join(', ') + '\n\n';
content += valueList.join(
series[i].type == ecConfig.CHART_TYPE_SCATTER ? '\n': ', '
);
content += '\n\n';
}
return content;
......@@ -298,23 +308,39 @@ define(function (require) {
var series = option.series;
for (i = 0, len = series.length; i < len; i++) {
contentIdx++;
contentValueList = content[contentIdx].split(',');
for (var j = 0, k = series[i].data.length; j < k; j++) {
value = (contentValueList[j] || '').replace(/.*:/,'');
value = _trim(value);
value = (value != '-' && value !== '')
? (value - 0)
: '-';
if (typeof series[i].data[j].value != 'undefined'
) {
series[i].data[j].value = value;
if (series[i].type == ecConfig.CHART_TYPE_SCATTER) {
for (var j = 0, k = series[i].data.length; j < k; j++) {
contentValueList = content[contentIdx];
value = contentValueList.replace(' ','').split(',');
if (typeof series[i].data[j].value != 'undefined'
) {
series[i].data[j].value = value;
}
else {
series[i].data[j] = value;
}
contentIdx++;
}
else {
series[i].data[j] = value;
}
else {
contentValueList = content[contentIdx].split(',');
for (var j = 0, k = series[i].data.length; j < k; j++) {
value = (contentValueList[j] || '').replace(/.*:/,'');
value = _trim(value);
value = (value != '-' && value !== '')
? (value - 0)
: '-';
if (typeof series[i].data[j].value != 'undefined'
) {
series[i].data[j].value = value;
}
else {
series[i].data[j] = value;
}
}
contentIdx++;
}
contentIdx++;
}
}
......
......@@ -245,13 +245,22 @@ define(function (require) {
_zoom.scatterMap = _zoom.scatterMap || {};
_zoom.scatterMap[seriesIndex] = _zoom.scatterMap[seriesIndex] || {};
var componentLibrary = require('../component');
var zrUtil = require('zrender/tool/util');
// x轴极值
var Axis = componentLibrary.get('axis');
var axisOption = zrUtil.clone(option.xAxis);
if (axisOption instanceof Array) {
axisOption[0].type = 'value';
axisOption[1] && (axisOption[1].type = 'value');
}
else {
axisOption.type = 'value';
}
var vAxis = new Axis(
null, // messageCenter
false, // zr
{
xAxis: option.xAxis,
xAxis: axisOption,
series : option.series
},
component,
......@@ -260,13 +269,22 @@ define(function (require) {
var axisIndex = option.series[seriesIndex].xAxisIndex || 0;
_zoom.scatterMap[seriesIndex].x =
vAxis.getAxis(axisIndex).getExtremum();
vAxis.dispose();
// y轴极值
axisOption = zrUtil.clone(option.yAxis);
if (axisOption instanceof Array) {
axisOption[0].type = 'value';
axisOption[1] && (axisOption[1].type = 'value');
}
else {
axisOption.type = 'value';
}
vAxis = new Axis(
null, // messageCenter
false, // zr
{
yAxis: option.yAxis,
yAxis: axisOption,
series : option.series
},
component,
......@@ -275,7 +293,8 @@ define(function (require) {
axisIndex = option.series[seriesIndex].yAxisIndex || 0;
_zoom.scatterMap[seriesIndex].y =
vAxis.getAxis(axisIndex).getExtremum();
//console.log(_zoom.scatterMap);
vAxis.dispose();
// console.log(_zoom.scatterMap);
}
function _buildBackground() {
......@@ -788,6 +807,17 @@ define(function (require) {
return;
}
function absoluteZoom(param) {
zoomOption.start = _zoom.start = param.start;
zoomOption.end = _zoom.end = param.end;
zoomOption.start2 = _zoom.start2 = param.start2;
zoomOption.end2 = _zoom.end2 = param.end2;
//console.log(rect,gridArea,_zoom,total)
_syncShape();
_syncData(true);
return;
}
function rectZoom(param) {
if (!param) {
// 重置拖拽
......@@ -803,7 +833,7 @@ define(function (require) {
_syncShape();
_syncData(true);
return true;
return _zoom;
}
var gridArea = component.grid.getArea();
var rect = {
......@@ -873,7 +903,7 @@ define(function (require) {
//console.log(rect,gridArea,_zoom,total)
_syncShape();
_syncData(true);
return true;
return _zoom;
}
function init(newOption) {
......@@ -903,6 +933,7 @@ define(function (require) {
}
self.init = init;
self.absoluteZoom = absoluteZoom;
self.rectZoom = rectZoom
self.ondragend = ondragend;
self.ondataZoom = ondataZoom;
......
......@@ -43,7 +43,7 @@ define(function (require) {
var _zoomStart;
var _zooming;
var _zoomShape;
var _hasZoom;
var _zoomQueue;
var _dataView;
......@@ -87,7 +87,7 @@ define(function (require) {
_iconDisable(_iconShapeMap['markUndo']);
_iconDisable(_iconShapeMap['markClear']);
}
if (_iconShapeMap['dataZoomReset']) {
if (_iconShapeMap['dataZoomReset'] && _zoomQueue.length === 0) {
_iconDisable(_iconShapeMap['dataZoomReset']);
}
}
......@@ -397,17 +397,17 @@ define(function (require) {
}
if (_zooming && component.dataZoom) {
_zooming = false;
_hasZoom = component.dataZoom.rectZoom(_zoomShape.style);
if (_hasZoom) {
var zoom = component.dataZoom.rectZoom(_zoomShape.style)
if (zoom) {
_zoomQueue.push({
start : zoom.start,
end : zoom.end,
start2 : zoom.start2,
end2 : zoom.end2
});
_iconEnable(_iconShapeMap['dataZoomReset']);
zr.refresh();
// console.log('data zoom',_zoomShape.style);
setTimeout(function(){
return;
zr
&& _resetZoom()
&& zr.refresh();
}, 10);
}
}
return true; // 阻塞全局事件
......@@ -494,10 +494,19 @@ define(function (require) {
if (_zooming) {
_zooming = false;
}
_iconDisable(_iconShapeMap['dataZoomReset']);
zr.refresh();
_hasZoom = false;
component.dataZoom.rectZoom();
_zoomQueue.pop();
//console.log(_zoomQueue)
if (_zoomQueue.length > 0) {
component.dataZoom.absoluteZoom(
_zoomQueue[_zoomQueue.length - 1]
);
}
else {
component.dataZoom.rectZoom();
_iconDisable(_iconShapeMap['dataZoomReset']);
zr.refresh();
}
return true;
}
......@@ -599,7 +608,7 @@ define(function (require) {
return true;
}
function resetMagicType(newOption) {
function reset(newOption) {
if (newOption.toolbox
&& newOption.toolbox.show
&& newOption.toolbox.feature.magicType
......@@ -643,6 +652,33 @@ define(function (require) {
}
}
_magicType = false;
var zoomOption = newOption.dataZoom;
if (zoomOption && zoomOption.show) {
var start = typeof zoomOption.start != 'undefined'
&& zoomOption.start >= 0
&& zoomOption.start <= 100
? zoomOption.start : 0;
var end = typeof zoomOption.end != 'undefined'
&& zoomOption.end >= 0
&& zoomOption.end <= 100
? zoomOption.end : 100;
if (start > end) {
// 大小颠倒自动翻转
start = start + end;
end = start - end;
start = start - end;
}
_zoomQueue = [{
start : start,
end : end,
start2 : 0,
end2 : 100
}];
}
else {
_zoomQueue = []
}
}
function getMagicOption(){
......@@ -788,7 +824,7 @@ define(function (require) {
self.resize = resize;
self.hideDataView = hideDataView;
self.getMagicOption = getMagicOption;
self.resetMagicType = resetMagicType;
self.reset = reset;
}
require('../component').define('toolbox', Toolbox);
......
......@@ -503,7 +503,7 @@ define(function(require) {
_selectedMap = {};
_option = zrUtil.clone(_optionBackup);
_island.clear();
_toolbox.resetMagicType(_option);
_toolbox.reset(_option);
_render(_option);
}
......@@ -593,7 +593,7 @@ define(function(require) {
_selectedMap = {};
_island.clear();
_toolbox.resetMagicType(_option);
_toolbox.reset(_option);
_render(_option);
return self;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册