提交 f11f294d 编写于 作者: K kener

动画过渡升级

上级 97881625
...@@ -663,14 +663,16 @@ define(function (require) { ...@@ -663,14 +663,16 @@ define(function (require) {
} }
} }
this._disposeChartList(); // this._disposeChartList();
this._zr.clear(); // this._zr.clear();
this._zr.clearAnimation();
this._chartList = [];
var chartLibrary = require('./chart'); var chartLibrary = require('./chart');
var componentLibrary = require('./component'); var componentLibrary = require('./component');
// 标题 // 标题
var title; var title = this.component.title && this.component.title.dispose();
if (magicOption.title) { if (magicOption.title) {
var Title = componentLibrary.get('title'); var Title = componentLibrary.get('title');
title = new Title( title = new Title(
...@@ -681,7 +683,7 @@ define(function (require) { ...@@ -681,7 +683,7 @@ define(function (require) {
} }
// 提示 // 提示
var tooltip; var tooltip = this.component.tooltip && this.component.tooltip.dispose();
if (magicOption.tooltip) { if (magicOption.tooltip) {
var Tooltip = componentLibrary.get('tooltip'); var Tooltip = componentLibrary.get('tooltip');
tooltip = new Tooltip( tooltip = new Tooltip(
...@@ -692,7 +694,7 @@ define(function (require) { ...@@ -692,7 +694,7 @@ define(function (require) {
} }
// 图例 // 图例
var legend; var legend = this.component.legend && this.component.legend.dispose();
if (magicOption.legend) { if (magicOption.legend) {
var Legend = componentLibrary.get('legend'); var Legend = componentLibrary.get('legend');
legend = new Legend( legend = new Legend(
...@@ -703,7 +705,7 @@ define(function (require) { ...@@ -703,7 +705,7 @@ define(function (require) {
} }
// 值域控件 // 值域控件
var dataRange; var dataRange = this.component.dataRange && this.component.dataRange.dispose();
if (magicOption.dataRange) { if (magicOption.dataRange) {
var DataRange = componentLibrary.get('dataRange'); var DataRange = componentLibrary.get('dataRange');
dataRange = new DataRange( dataRange = new DataRange(
...@@ -714,10 +716,10 @@ define(function (require) { ...@@ -714,10 +716,10 @@ define(function (require) {
} }
// 直角坐标系 // 直角坐标系
var grid; var grid = this.component.grid && this.component.grid.dispose();
var dataZoom; var dataZoom = this.component.dataZoom && this.component.dataZoom.dispose();
var xAxis; var xAxis = this.component.xAxis && this.component.xAxis.dispose();
var yAxis; var yAxis = this.component.yAxis && this.component.yAxis.dispose();
if (magicOption.grid || magicOption.xAxis || magicOption.yAxis) { if (magicOption.grid || magicOption.xAxis || magicOption.yAxis) {
var Grid = componentLibrary.get('grid'); var Grid = componentLibrary.get('grid');
grid = new Grid(this._themeConfig, this._messageCenter, this._zr, magicOption); grid = new Grid(this._themeConfig, this._messageCenter, this._zr, magicOption);
...@@ -726,60 +728,35 @@ define(function (require) { ...@@ -726,60 +728,35 @@ define(function (require) {
var DataZoom = componentLibrary.get('dataZoom'); var DataZoom = componentLibrary.get('dataZoom');
dataZoom = new DataZoom( dataZoom = new DataZoom(
this._themeConfig, this._themeConfig, this._messageCenter, this._zr,
this._messageCenter, magicOption, this.component
this._zr,
magicOption,
{
'legend' : legend,
'grid' : grid
}
); );
this._chartList.push(dataZoom); this._chartList.push(dataZoom);
this.component.dataZoom = dataZoom; this.component.dataZoom = dataZoom;
var Axis = componentLibrary.get('axis'); var Axis = componentLibrary.get('axis');
xAxis = new Axis( xAxis = new Axis(
this._themeConfig, this._themeConfig, this._messageCenter, this._zr,
this._messageCenter, magicOption, this.component, 'xAxis'
this._zr,
magicOption,
{
'legend' : legend,
'grid' : grid
},
'xAxis'
); );
this._chartList.push(xAxis); this._chartList.push(xAxis);
this.component.xAxis = xAxis; this.component.xAxis = xAxis;
yAxis = new Axis( yAxis = new Axis(
this._themeConfig, this._themeConfig, this._messageCenter, this._zr,
this._messageCenter, magicOption, this.component, 'yAxis'
this._zr,
magicOption,
{
'legend' : legend,
'grid' : grid
},
'yAxis'
); );
this._chartList.push(yAxis); this._chartList.push(yAxis);
this.component.yAxis = yAxis; this.component.yAxis = yAxis;
} }
// 极坐标系 // 极坐标系
var polar; var polar = this.component.polar && this.component.polar.dispose();
if (magicOption.polar) { if (magicOption.polar) {
var Polar = componentLibrary.get('polar'); var Polar = componentLibrary.get('polar');
polar = new Polar( polar = new Polar(
this._themeConfig, this._themeConfig, this._messageCenter, this._zr,
this._messageCenter, magicOption, this.component
this._zr,
magicOption,
{
'legend' : legend
}
); );
this._chartList.push(polar); this._chartList.push(polar);
this.component.polar = polar; this.component.polar = polar;
...@@ -801,21 +778,16 @@ define(function (require) { ...@@ -801,21 +778,16 @@ define(function (require) {
chartMap[chartType] = true; chartMap[chartType] = true;
ChartClass = chartLibrary.get(chartType); ChartClass = chartLibrary.get(chartType);
if (ChartClass) { if (ChartClass) {
chart = new ChartClass( if (this.chart[chartType]) {
this._themeConfig, chart = this.chart[chartType];
this._messageCenter, chart.refresh(magicOption);
this._zr, }
magicOption, else {
{ chart = new ChartClass(
'tooltip' : tooltip, this._themeConfig, this._messageCenter, this._zr,
'legend' : legend, magicOption, this.component
'dataRange' : dataRange, );
'grid' : grid, }
'xAxis' : xAxis,
'yAxis' : yAxis,
'polar' : polar
}
);
this._chartList.push(chart); this._chartList.push(chart);
this.chart[chartType] = chart; this.chart[chartType] = chart;
} }
...@@ -824,10 +796,18 @@ define(function (require) { ...@@ -824,10 +796,18 @@ define(function (require) {
} }
} }
} }
// 已有实例但新option不带这类图表的实例释放
for (chartType in this.chart) {
if (chartType != ecConfig.CHART_TYPE_ISLAND && !chartMap[chartType]) {
this.chart[chartType].dispose();
this.chart[chartType] = null;
delete this.chart[chartType];
}
}
this._island.render(magicOption); this._island.render(magicOption);
this._toolbox.render(magicOption, {dataZoom: dataZoom}); this._toolbox.render(magicOption, this.component);
if (magicOption.animation && !magicOption.renderAsImage) { if (magicOption.animation && !magicOption.renderAsImage) {
var len = this._chartList.length; var len = this._chartList.length;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册