Skip to content

Commit

Permalink
雷达图formatter升级
Browse files Browse the repository at this point in the history
  • Loading branch information
kener committed Nov 4, 2013
1 parent b35b005 commit 543c5e4
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 4 deletions.
39 changes: 38 additions & 1 deletion doc/example/radar.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,44 @@
{ text : '指标五' }
],
center : [250,210],
radius : 150
radius : 150,
startAngle: 90,
splitNumber: 8,
name : {
formatter:'【{value}】',
textStyle: {color:'red'}
},
scale: true,
precision: 1,
//power: 100,
axisLine: { // 坐标轴线
show: true, // 默认显示,属性show控制显示与否
lineStyle: { // 属性lineStyle控制线条样式
color: 'green',
width: 2,
type: 'solid'
}
},
axisLabel: { // 坐标轴文本标签,详见axis.axisLabel
show: false,
// formatter: null,
textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
color: '#ccc'
}
},
splitArea : {
show : true,
areaStyle : {
color: ['rgba(250,0,250,0.3)','rgba(0,200,200,0.3)']
}
},
splitLine : {
show : true,
lineStyle : {
width : 2,
color : 'yellow'
}
}
},
{
indicator : [
Expand Down
12 changes: 9 additions & 3 deletions src/component/polar.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,17 @@ define(

style.styleFont = self.getFont(textStyle);

if (typeof name.formatter != 'function') {
style.text = indicator[i].text;

if (typeof name.formatter == 'function') {
style.text = name.formatter(indicator[i].text, i);
}
else if (typeof name.formatter == 'string'){
style.text = name.formatter.replace(
'{value}', indicator[i].text
);
}
else {
style.text = name.formatter(i, indicator[i].text);
style.text = indicator[i].text;
}

vector = __ecIndicator[i].vector;
Expand Down

0 comments on commit 543c5e4

Please sign in to comment.