Skip to content

Commit

Permalink
Area chart
Browse files Browse the repository at this point in the history
  • Loading branch information
pissang committed Sep 26, 2015
1 parent 1940aff commit 096c0f1
Show file tree
Hide file tree
Showing 15 changed files with 451 additions and 174 deletions.
4 changes: 2 additions & 2 deletions src/chart/helper/DataSymbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ define(function (require) {
var graphic = require('../../util/graphic');

function createSymbol(data, idx, enableAnimation) {
var point = data.getItemLayout(idx).point;
var point = data.getItemLayout(idx);
var color = data.getItemVisual(idx, 'color');

var symbolSize = data.getItemVisual(idx, 'symbolSize');
Expand Down Expand Up @@ -85,7 +85,7 @@ define(function (require) {
}

var symbolSize = data.getItemVisual(newIdx, 'symbolSize');
var point = data.getItemLayout(newIdx).point;
var point = data.getItemLayout(newIdx);
var el = oldData.getItemGraphicEl(oldIdx);

// Symbol changed
Expand Down
2 changes: 1 addition & 1 deletion src/chart/line.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ define(function (require) {
require('../visual/symbol'), 'line', 'circle', 'line'
));
echarts.registerLayout(zrUtil.curry(
require('../layout/line'), 'line'
require('../layout/points'), 'line'
));
});
37 changes: 37 additions & 0 deletions src/chart/line/Area.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
define(function(require) {
'use strict';

return require('zrender/graphic/Path').extend({

type: 'ec-area',

shape: {
points: [],
// Offset between stacked base points and points
stackedOnPoints: []
},

buildPath: function (ctx, shape) {
var points = shape.points;
var stackedOnPoints = shape.stackedOnPoints;

var i = 0;
var len = points.length;
while (i < points.length) {
for (var k = i; k < len; k++) {
var p = points[k];
if (p == null || isNaN(p[0]) || isNaN(p[1])) {
break;
}
ctx[k === i ? 'moveTo' : 'lineTo'](p[0], p[1]);
}
var tmp = k;
for (k--; k >= i; k--) {
var p = stackedOnPoints[k];
ctx.lineTo(p[0], p[1]);
}
i = tmp + 1;
}
}
});
});
Loading

0 comments on commit 096c0f1

Please sign in to comment.