Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
alon@wen
echarts
提交
366dc77b
E
echarts
项目概览
alon@wen
/
echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
echarts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
366dc77b
编写于
8月 06, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Daily update
上级
099cc569
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
212 addition
and
40 deletion
+212
-40
src/CoordinateSystem.js
src/CoordinateSystem.js
+4
-0
src/api/ExtensionAPI.js
src/api/ExtensionAPI.js
+5
-2
src/api/graphic.js
src/api/graphic.js
+81
-0
src/chart/bar/Bar.js
src/chart/bar/Bar.js
+21
-2
src/chart/pie/Pie.js
src/chart/pie/Pie.js
+2
-4
src/component/dataZoom/DataZoom.js
src/component/dataZoom/DataZoom.js
+2
-4
src/component/legend/Legend.js
src/component/legend/Legend.js
+2
-2
src/coord/Grid.js
src/coord/Grid.js
+40
-7
src/core/number.js
src/core/number.js
+27
-1
src/core/quickSelect.js
src/core/quickSelect.js
+4
-4
src/echarts.js
src/echarts.js
+24
-14
未找到文件。
src/CoordinateSystem.js
浏览文件 @
366dc77b
...
...
@@ -26,6 +26,10 @@ define(function(require) {
if
(
list
)
{
return
list
[
idx
];
}
},
resize
:
function
()
{
}
}
...
...
src/ExtensionAPI.js
→
src/
api/
ExtensionAPI.js
浏览文件 @
366dc77b
...
...
@@ -4,13 +4,16 @@ define(function(require) {
var
zrUtil
=
require
(
'
zrender/core/util
'
);
var
e
xtensionAPIList
=
[
'
addProcessor
'
,
'
update
'
,
'
getCoordinateSystem
'
];
var
e
chartsAPIList
=
[
'
getZr
'
,
'
addProcessor
'
,
'
update
'
,
'
getCoordinateSystem
'
];
function
ExtensionAPI
(
echarts
)
{
zrUtil
.
each
(
e
xtension
APIList
,
function
(
name
)
{
zrUtil
.
each
(
e
charts
APIList
,
function
(
name
)
{
this
[
name
]
=
zrUtil
.
bind
(
echarts
[
name
],
echarts
);
},
this
);
};
// Mix graphic api
zrUtil
.
merge
(
ExtensionAPI
.
prototype
,
require
(
'
./graphic
'
));
return
ExtensionAPI
;
});
\ No newline at end of file
src/api/graphic.js
0 → 100644
浏览文件 @
366dc77b
define
(
function
(
require
)
{
'
use strict
'
;
var
Group
=
require
(
'
zrender/container/Group
'
);
var
Circle
=
require
(
'
zrender/graphic/Circle
'
);
var
ZImage
=
require
(
'
zrender/graphic/Image
'
);
var
Text
=
require
(
'
zrender/graphic/Text
'
);
var
Polygon
=
require
(
'
zrender/graphic/Polygon
'
);
var
Polyline
=
require
(
'
zrender/graphic/Polyline
'
);
var
pathTool
=
require
(
'
zrender/tool/path
'
);
var
transformPath
=
require
(
'
zrender/tool/transformPath
'
);
var
matrix
=
require
(
'
zrender/core/matrix
'
);
return
{
/**
* Create a group element
*/
createGroup
:
function
(
opts
)
{
return
new
Group
(
opts
);
},
/**
* Create a path element from path data string
*/
createPath
:
function
(
pathData
,
opts
,
rect
)
{
var
path
=
pathTool
.
createFromString
(
pathData
,
opts
);
if
(
rect
)
{
this
.
resizePath
(
path
,
rect
);
}
return
path
;
},
/**
* Resize a path to fit the rect
*/
resizePath
:
function
(
path
,
rect
)
{
var
pathRect
=
path
.
getBoundingRect
();
var
dx
=
rect
.
x
-
pathRect
.
x
;
var
dy
=
rect
.
y
-
pathRect
.
y
;
var
sx
=
rect
.
width
/
pathRect
.
width
;
var
sy
=
rect
.
height
/
pathRect
.
height
;
var
m
=
matrix
.
create
();
matrix
.
translate
(
m
,
m
,
[
dx
,
dy
]);
matrix
.
scale
(
m
,
m
,
[
sx
,
sy
]);
// TODOTODOTODOTODO
transformPath
(
path
,
m
);
},
/**
* Create a circle element
*/
createCircle
:
function
()
{
},
createImage
:
function
()
{
},
createText
:
function
()
{
},
createSector
:
function
()
{
},
createPolygon
:
function
()
{
},
createPolyline
:
function
()
{
}
}
});
\ No newline at end of file
src/chart/bar/Bar.js
浏览文件 @
366dc77b
define
(
function
(
require
)
{
var
Chart
=
require
(
'
../Chart
'
);
var
zrUtil
=
require
(
'
zrender/core/util
'
);
require
(
'
./BarSeries
'
);
...
...
@@ -10,8 +11,26 @@ define(function (require) {
init
:
function
()
{},
render
:
function
(
option
,
api
)
{
render
:
function
(
series
,
option
,
api
)
{
var
coordinateSystemType
=
series
.
get
(
'
coordinateSystem
'
);
if
(
coordinateSystemType
===
'
cartesian
'
)
{
this
.
_renderCartesianBar
(
series
,
option
,
api
);
}
},
_renderCartesianBar
:
function
(
series
,
option
,
api
)
{
// Currently only one grid is supported
var
grid
=
api
.
getCoordinateSystem
(
'
grid
'
,
0
);
var
data
=
series
.
getData
();
var
coords
=
grid
.
dataToCoords
(
data
,
series
.
get
(
'
xAxisIndex
'
),
series
.
get
(
'
yAxisIndex
'
)
);
data
.
each
(
function
(
dataItem
,
idx
)
{
var
coord
=
coords
[
idx
];
});
}
});
...
...
src/chart/pie/Pie.js
浏览文件 @
366dc77b
...
...
@@ -13,12 +13,10 @@ define(function (require) {
this
.
_dataItemFilter
=
dataItemFilter
;
api
.
addProcessor
(
dataItemFilter
,
true
);
},
render
:
function
()
{
render
:
function
(
series
,
option
,
api
)
{
},
dispose
:
function
()
{}
...
...
src/component/dataZoom/DataZoom.js
浏览文件 @
366dc77b
...
...
@@ -5,13 +5,11 @@ define(function (require) {
type
:
'
dataZoom
'
,
init
:
function
(
echarts
)
{
},
render
:
function
(
option
)
{
},
}
});
});
\ No newline at end of file
src/component/legend/Legend.js
浏览文件 @
366dc77b
...
...
@@ -6,8 +6,8 @@ define(function (require) {
type
:
'
legend
'
,
render
:
function
(
option
,
globalState
)
{
var
selectedStateGroup
=
globalS
tate
.
get
(
'
legend.selected
'
);
render
:
function
(
option
,
state
,
api
)
{
var
selectedStateGroup
=
s
tate
.
get
(
'
legend.selected
'
);
if
(
selectedStateGroup
)
{
zrUtil
.
each
(
selectedStateGroup
,
function
(
selectedState
)
{
...
...
src/coord/Grid.js
浏览文件 @
366dc77b
...
...
@@ -10,6 +10,7 @@ define(function(require, factory) {
var
Axis2D
=
require
(
'
./CartesianAxis2D
'
);
var
OrdinalScale
=
require
(
'
../scale/Ordinal
'
);
var
IntervalScale
=
require
(
'
../scale/Interval
'
);
var
numberUtil
=
require
(
'
../core/number
'
);
function
Grid
()
{
...
...
@@ -34,14 +35,42 @@ define(function(require, factory) {
this
.
_initCartesian
(
option
);
},
getRect
:
function
()
{
return
{
x
:
this
.
_x
,
y
:
this
.
_y
,
width
:
this
.
_width
,
height
:
this
.
_height
};
},
/**
* Resize the grid
*/
resize
:
function
(
option
,
api
)
{
var
gridX
=
this
.
_x
;
var
gridY
=
this
.
_y
;
var
gridWidth
=
this
.
_width
;
var
gridHeight
=
this
.
_height
;
resize
:
function
(
optionModel
,
api
)
{
var
viewportWidth
=
api
.
getWidth
();
var
viewportHeight
=
api
.
getHeight
();
var
grid
=
optionModel
.
get
(
'
grid
'
);
var
parsePercent
=
numberUtil
.
parsePercent
;
var
gridX
=
parsePercent
(
grid
.
x
,
viewportWidth
);
var
gridY
=
parsePercent
(
grid
.
y
,
viewportHeight
);
var
gridX2
=
parsePercent
(
grid
.
x2
,
viewportWidth
);
var
gridY2
=
parsePercent
(
grid
.
y2
,
viewportHeight
);
var
gridWidth
=
parsePercent
(
grid
.
width
,
viewportWidth
);
var
gridHeight
=
parsePercent
(
grid
.
height
,
viewportHeight
);
if
(
isNaN
(
gridWidth
))
{
gridWidth
=
gridX2
-
gridX
;
}
if
(
isNaN
(
gridHeight
))
{
gridHeight
=
gridY2
-
gridY
;
}
this
.
_x
=
gridX
;
this
.
_y
=
gridY
;
this
.
_width
=
gridWidth
;
this
.
_height
=
gridHeight
;
zrUtil
.
each
(
this
.
_axesList
,
function
(
axis
)
{
var
extent
;
...
...
@@ -107,6 +136,10 @@ define(function(require, factory) {
yAxisIndex
=
yAxisIndex
||
0
;
var
cartesian
=
this
.
getCartesian
(
xAxisIndex
,
yAxisIndex
);
if
(
!
cartesian
)
{
// Error
return
;
}
var
xAxis
=
cartesian
.
getAxis
(
'
x
'
);
var
yAxis
=
cartesian
.
getAxis
(
'
y
'
);
...
...
@@ -158,7 +191,7 @@ define(function(require, factory) {
var
xAxisType
=
xAxisOpt
.
type
;
// Create x axis
var
axisX
=
new
Axis2D
(
'
x
'
,
getScaleByOption
(
xAxis
Opt
,
xAxisOpt
),
'
x
'
,
getScaleByOption
(
xAxis
Type
,
xAxisOpt
),
[
0
,
0
],
xAxisOpt
.
type
,
xAxisOpt
.
position
...
...
@@ -262,7 +295,7 @@ define(function(require, factory) {
}
});
}
}
}
;
Grid
.
create
=
function
(
option
,
api
)
{
if
(
option
.
grid
)
{
...
...
src/core/number.js
浏览文件 @
366dc77b
...
...
@@ -5,6 +5,10 @@
define
(
function
(
require
)
{
function
_trim
(
str
)
{
return
str
.
replace
(
/^
\s
+/
,
''
).
replace
(
/
\s
+$/
,
''
);
}
/**
* Linear mapping a value from domain to range
* @memberOf module:echarts/core/number
...
...
@@ -27,8 +31,30 @@ define(function (require) {
return
t
*
(
range
[
1
]
-
range
[
0
])
+
range
[
0
];
};
/**
* Convert a percent string to absolute number.
* Returns NaN if percent is not a valid string or number
* @memberOf module:echarts/core/number
* @param {string|number} percent
* @param {number} all
* @return {number}
*/
function
parsePercent
(
percent
,
all
)
{
if
(
typeof
percent
===
'
string
'
)
{
if
(
_trim
(
percent
).
match
(
/%$/
))
{
return
parseFloat
(
percent
)
/
100
*
all
;
}
return
parseFloat
(
percent
);
}
return
+
percent
;
}
return
{
linearMap
:
linearMap
linearMap
:
linearMap
,
parsePercent
:
parsePercent
}
});
\ No newline at end of file
src/core/quickSelect.js
浏览文件 @
366dc77b
...
...
@@ -3,7 +3,7 @@
*
* Note: it will change the elements placement in array.
*
* @module echarts/
data
/quickSelect
* @module echarts/
core
/quickSelect
* @author Yi Shen(https://github.com/pissang)
*/
define
(
function
(
require
)
{
...
...
@@ -49,14 +49,14 @@ define(function (require) {
}
/**
* @alias module:echarts/
data
/quickSelect
* @alias module:echarts/
core
/quickSelect
* @param {Array} list
* @param {number} [left]
* @param {number} [right]
* @param {number} nth
* @param {Function} [compareFunc]
* @example
* var quickSelect = require('echarts/
data
/quickSelect');
* var quickSelect = require('echarts/
core
/quickSelect');
* var list = [5, 2, 1, 4, 3]
* quickSelect(list, 3);
* quickSelect(list, 0, 3, 1, function (a, b) {return a - b});
...
...
@@ -77,6 +77,6 @@ define(function (require) {
}
return
select
(
list
,
left
,
right
,
nth
,
compareFunc
);
}
return
quickSelect
;
});
\ No newline at end of file
src/echarts.js
浏览文件 @
366dc77b
...
...
@@ -66,6 +66,9 @@ define(function (require) {
});
this
.
_originalOption
=
option
;
// Processed option is same with originalOption before processing
// PENDING
this
.
_processedOption
=
option
;
this
.
_prepareComponents
(
option
);
...
...
@@ -103,18 +106,17 @@ define(function (require) {
},
updateImmediately
:
function
()
{
// TODO Performance
var
option
=
this
.
_originalOption
.
clone
();
var
processedOption
=
this
.
_processOption
(
this
.
_originalOption
);
this
.
_
coordinateSystem
.
update
(
option
)
;
this
.
_
processedOption
=
processedOption
;
this
.
_
processOption
(
option
,
this
.
_state
);
this
.
_
coordinateSystem
.
update
(
processedOption
);
this
.
_doRender
(
o
ption
);
this
.
_doRender
(
processedO
ption
);
},
resize
:
function
()
{
this
.
_coordinateSystem
.
resize
(
this
.
_processedOption
,
this
.
_extensionAPI
);
},
_prepareCharts
:
function
(
option
)
{
...
...
@@ -128,7 +130,7 @@ define(function (require) {
chart
=
Chart
.
create
(
series
);
if
(
chart
)
{
chart
.
init
(
this
.
_extensionAPI
);
this
.
_chartsMap
[
series
.
type
]
=
chart
;
this
.
_chartsMap
[
id
]
=
chart
;
this
.
_chartsList
.
push
(
chart
);
}
else
{
...
...
@@ -179,22 +181,30 @@ define(function (require) {
},
this
);
},
_processOption
:
function
(
option
,
globalState
)
{
_processOption
:
function
(
option
)
{
// TODO Performance
option
=
option
.
clone
();
zrUtil
.
each
(
this
.
_processors
,
function
(
processor
)
{
processor
.
syncState
(
globalS
tate
);
processor
.
syncState
(
this
.
_s
tate
);
processor
.
process
(
option
);
});
},
this
);
return
option
;
},
_doRender
:
function
(
option
)
{
_doRender
:
function
(
option
Model
,
stateModel
)
{
var
api
=
this
.
_extensionAPI
;
// Render all components
zrUtil
.
each
(
this
.
_components
,
function
(
component
)
{
component
.
render
(
option
,
api
);
});
component
.
render
(
option
Model
,
stateModel
,
api
);
}
,
this
);
// Render all charts
optionModel
.
eachSeries
(
function
(
series
,
idx
)
{
var
id
=
series
.
type
+
'
_
'
+
(
series
.
name
||
idx
);
});
zrUtil
.
each
(
this
.
_charts
,
function
(
chart
)
{
var
group
=
chart
.
render
(
option
,
api
);
var
group
=
chart
.
render
(
option
Model
,
api
);
this
.
zr
.
addElement
(
group
);
},
this
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录