Skip to content

Commit

Permalink
Merge and fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pissang committed Dec 25, 2015
1 parent 352197d commit e307e1f
Showing 19 changed files with 131 additions and 71 deletions.
1 change: 1 addition & 0 deletions build/config.js
Original file line number Diff line number Diff line change
@@ -52,6 +52,7 @@
'echarts/component/markLine',

'echarts/component/timeline',
'echarts/component/toolbox',

'echarts/scale/Time',
'echarts/scale/Log',
5 changes: 4 additions & 1 deletion build/wrap/end.js
Original file line number Diff line number Diff line change
@@ -4,6 +4,9 @@ var echarts = require('echarts');
require("${mod}");
/** /for */

return echarts;
/** if: ${vml} */
require('zrender/vml/vml');
/** /if */

return echarts;
}));
15 changes: 13 additions & 2 deletions src/chart/graph/GraphView.js
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ define(function (require) {
var RoamController = require('../../component/helper/RoamController');

var modelUtil = require('../../util/model');
var graphic = require('../../util/graphic');

require('../../echarts').extendChartView({

@@ -24,6 +25,8 @@ define(function (require) {
this._symbolDraw = symbolDraw;
this._lineDraw = lineDraw;
this._controller = controller;

this._firstRender = true;
},

render: function (seriesModel, ecModel, api) {
@@ -68,10 +71,16 @@ define(function (require) {
});

var group = this.group;
group.attr({
var groupNewProp = {
position: coordSys.position,
scale: coordSys.scale
});
};
if (this._firstRender) {
group.attr(groupNewProp);
}
else {
graphic.updateProps(group, groupNewProp, seriesModel);
}

this._nodeScaleRatio = seriesModel.get('nodeScaleRatio');
// this._edgeScaleRatio = seriesModel.get('edgeScaleRatio');
@@ -106,6 +115,8 @@ define(function (require) {
}
el.setDraggable(draggable);
}, this);

this._firstRender = false;
},

_startForceLayoutIteration: function (forceLayout, layoutAnimation) {
1 change: 0 additions & 1 deletion src/chart/treemap/Breadcrumb.js
Original file line number Diff line number Diff line change
@@ -124,7 +124,6 @@
lineJoin: 'bevel',
text: text,
textFill: textStyleModel.getTextColor(),
textAlign: 'left',
textFont: textStyleModel.getFont()
}
),
40 changes: 21 additions & 19 deletions src/echarts.js
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ define(function (require) {
* @type {Array.<module:echarts/view/Chart>}
* @private
*/
this._chartsList = [];
this._chartsViews = [];

/**
* @type {Object.<string, module:echarts/view/Chart>}
@@ -106,7 +106,7 @@ define(function (require) {
* @type {Array.<module:echarts/view/Component>}
* @private
*/
this._componentsList = [];
this._componentsViews = [];

/**
* @type {Object.<string, module:echarts/view/Component>}
@@ -485,7 +485,7 @@ define(function (require) {
ecModel.eachComponent(
{mainType: 'series', query: payload},
function (seriesModel, index, payloadInfo) {
var chartView = this._chartsMap[seriesModel.id];
var chartView = this._chartsMap[seriesModel.__viewId];
if (chartView) {
chartView[method](
seriesModel, ecModel, this._api, payloadInfo
@@ -577,7 +577,7 @@ define(function (require) {
var api = this._api;

// Update all components
each(this._componentsList, function (component) {
each(this._componentsViews, function (component) {
var componentModel = component.__model;
component[methodName](componentModel, ecModel, api, payload);

@@ -586,7 +586,7 @@ define(function (require) {

// Upate all charts
ecModel.eachSeries(function (seriesModel, idx) {
var chart = this._chartsMap[seriesModel.id];
var chart = this._chartsMap[seriesModel.__viewId];
chart[methodName](seriesModel, ecModel, api, payload);

updateZ(seriesModel, chart);
@@ -601,7 +601,7 @@ define(function (require) {
*/
function prepareView(type, ecModel) {
var isComponent = type === 'component';
var viewList = isComponent ? this._componentsList : this._chartsList;
var viewList = isComponent ? this._componentsViews : this._chartsViews;
var viewMap = isComponent ? this._componentsMap : this._chartsMap;
var zr = this._zr;

@@ -619,7 +619,8 @@ define(function (require) {
model = componentType;
}

var view = viewMap[model.id];
var viewId = model.id + '_' + model.type;
var view = viewMap[viewId];
if (!view) {
var classType = ComponentModel.parseClassType(model.type);
var Clazz = isComponent
@@ -628,7 +629,7 @@ define(function (require) {
if (Clazz) {
view = new Clazz();
view.init(ecModel, this._api);
viewMap[model.id] = view;
viewMap[viewId] = view;
viewList.push(view);
zr.add(view.group);
}
@@ -638,8 +639,9 @@ define(function (require) {
}
}

model.__viewId = viewId;
view.__keepAlive = true;
view.__id = model.id;
view.__id = viewId;
view.__model = model;
}, this);

@@ -723,28 +725,28 @@ define(function (require) {
function doRender(ecModel, payload) {
var api = this._api;
// Render all components
each(this._componentsList, function (component) {
var componentModel = component.__model;
component.render(componentModel, ecModel, api, payload);
each(this._componentsViews, function (componentView) {
var componentModel = componentView.__model;
componentView.render(componentModel, ecModel, api, payload);

updateZ(componentModel, component);
updateZ(componentModel, componentView);
}, this);

each(this._chartsList, function (chart) {
each(this._chartsViews, function (chart) {
chart.__keepAlive = false;
}, this);

// Render all charts
ecModel.eachSeries(function (seriesModel, idx) {
var chart = this._chartsMap[seriesModel.id];
chart.__keepAlive = true;
chart.render(seriesModel, ecModel, api, payload);
var chartView = this._chartsMap[seriesModel.__viewId];
chartView.__keepAlive = true;
chartView.render(seriesModel, ecModel, api, payload);

updateZ(seriesModel, chart);
updateZ(seriesModel, chartView);
}, this);

// Remove groups of unrendered charts
each(this._chartsList, function (chart) {
each(this._chartsViews, function (chart) {
if (!chart.__keepAlive) {
chart.remove(ecModel, api);
}
5 changes: 3 additions & 2 deletions src/model/globalDefault.js
Original file line number Diff line number Diff line change
@@ -9,10 +9,10 @@ define(function () {
backgroundColor: 'rgba(0,0,0,0)',

// https://dribbble.com/shots/1065960-Infographic-Pie-chart-visualization
// color: ['#5793f3', '#d14a61', '#fd9c35', '#675bba', '#fec42c',
// '#dd4444', '#d4df5a', '#cd4870'],
// color: ['#5793f3', '#d14a61', '#fd9c35', '#675bba', '#fec42c', '#dd4444', '#d4df5a', '#cd4870'],
// 浅色
// color: ['#bcd3bb', '#e88f70', '#edc1a5', '#9dc5c8', '#e1e8c8', '#7b7c68', '#e5b5b5', '#f0b489', '#928ea8', '#bda29a'],
// color: ['#cc5664', '#9bd6ec', '#ea946e', '#8acaaa', '#f1ec64', '#ee8686', '#a48dc1', '#5da6bc', '#b9dcae'],
// 深色
color: ['#c23531', '#314656', '#61a0a8', '#dd8668', '#91c7ae', '#6e7074', '#61a0a8', '#bda29a', '#44525d', '#c4ccd3'],

@@ -21,6 +21,7 @@ define(function () {

// 主题,主题
textStyle: {
// color: '#000',
decoration: 'none',
// PENDING
fontFamily: platform.match(/^Win/) ? 'Microsoft YaHei' : 'sans-serif',
3 changes: 2 additions & 1 deletion test/axes.html
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@
var makePolar = zrUtil.curry(makeChart, defaultPolarOption);



console.profile('render');
renderTitle('cartesian normal');

// inverse
@@ -398,6 +398,7 @@
parallelAxis: makeParallelAxisOption({inverse: true, nameLocation: 'start'})
});

console.profileEnd('render');
});

function makeParallelAxisOption(secondOpt) {
27 changes: 19 additions & 8 deletions test/bar.html
Original file line number Diff line number Diff line change
@@ -22,14 +22,15 @@
require([
'echarts',
'echarts/chart/bar',
'echarts/chart/line',
'echarts/component/legend',
'echarts/component/grid',
'echarts/component/tooltip'
'echarts/component/tooltip',
'echarts/component/toolbox',
'zrender/vml/vml'
], function (echarts) {

var chart = echarts.init(document.getElementById('main'), null, {
renderer: 'canvas'
});
var chart = echarts.init(document.getElementById('main'));

var xAxisData = [];
var data1 = [];
@@ -65,16 +66,26 @@

chart.setOption({
legend: {
borderWidth: 1,
data: [{
name: 'bar'
}, 'bar2', 'bar3', 'bar4'],
selected: {
// 'bar': false
},
orient: 'vertical',
x: 'right',
y: 'bottom',
align: 'right'
// orient: 'vertical',
// x: 'right',
// y: 'bottom',
align: 'left'
},
toolbox: {
// y: 'bottom',
feature: {
magicType: {
type: ['line', 'bar', 'stack', 'tiled']
},
saveAsImage: {}
}
},
tooltip: {},
xAxis: {
2 changes: 1 addition & 1 deletion test/config.js
Original file line number Diff line number Diff line change
@@ -17,6 +17,6 @@ require.config({
location: '../../zrender-dev3.0/src',
name: 'zrender'
}
]//,
]
// urlArgs: '_v_=' + +new Date()
});
14 changes: 11 additions & 3 deletions test/connect.html
Original file line number Diff line number Diff line change
@@ -29,7 +29,8 @@
'echarts/chart/scatter',
'echarts/component/legend',
'echarts/component/grid',
'echarts/component/dataRange'
'echarts/component/dataRange',
'echarts/component/tooltip'
], function (echarts) {

var chart1 = echarts.init(document.getElementById('chart1'));
@@ -53,6 +54,9 @@
y: 50,
data: ['scatter']
},
tooltip: {
formatter: '{c}'
},
grid: {
y: '26%',
y2: '26%'
@@ -76,7 +80,7 @@
// selectedMode: 'single',
selectedMode: 'multiple',
backgroundColor: '#eee',
dimension: 'z',
dimension: 2,
selected: [],
min: 0,
max: 24,
@@ -103,6 +107,9 @@
y: 50,
data: ['scatter']
},
tooltip: {
formatter: '{c}'
},
grid: {
y: '26%',
y2: '26%'
@@ -125,7 +132,7 @@
// selectedMode: 'single',
selectedMode: 'multiple',
backgroundColor: '#eee',
dimension: 'z',
dimension: 2,
selected: [],
min: 0,
max: 24,
@@ -148,6 +155,7 @@
});

echarts.connect([chart1, chart2]);

});

</script>
16 changes: 8 additions & 8 deletions test/dataZoom-cartesian-h.html
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@

require([
'echarts',
'echarts/chart/line',
'echarts/chart/bar',
'echarts/component/legend',
'echarts/component/grid',
'echarts/component/axis',
@@ -54,7 +54,7 @@

chart.setOption({
legend: {
data: ['line', 'line2', 'line3']
data: ['bar', 'bar2', 'bar3']
},
tooltip: {
trigger: 'axis'
@@ -70,22 +70,22 @@
},
series: [
{
name: 'line2',
type: 'line',
name: 'bar2',
type: 'bar',
stack: 'all',
data: data2,
smooth: true
},
{
name: 'line3',
type: 'line',
name: 'bar3',
type: 'bar',
stack: 'all',
data: data3,
smooth: 0.1
},
{
name: 'line',
type: 'line',
name: 'bar',
type: 'bar',
data: data1,
smooth: true,
stack: 'all',
Loading

0 comments on commit e307e1f

Please sign in to comment.