Skip to content

Commit

Permalink
柱形itemStyle改造,属性冲突 fixed #662
Browse files Browse the repository at this point in the history
  • Loading branch information
kener committed Sep 1, 2014
1 parent 99d070a commit 4895ec9
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 31 deletions.
26 changes: 19 additions & 7 deletions doc/doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -3553,21 +3553,33 @@ <h4>itemStyle<a name="ItemStyle"> </a></h4>
</tr>
<tr>
<td> <b>{string}</b> borderColor </td>
<td> 各异 </td>
<td> 折线图(symbol),散点图(symbole),饼图,markPoint</td>
<td> 边框颜色 </td>
</tr>
<tr>
<td> <b>{number}</b> borderWidth </td>
<td> 各异 </td>
<td> 折线图(symbol),散点图(symbole),饼图,markPoint</td>
<td> 边框线宽,单位px </td>
</tr>
<tr>
<td> <b>{string}</b> barBorderColor </td>
<td> '#fff' </td>
<td> 柱形图,折线图(symbol),散点图(symbole),饼图,markPoint</td>
<td> 柱形边框颜色 </td>
<td> 柱形图</td>
<td> 边框颜色 </td>
</tr>
<tr>
<td> <b>{number}</b> borderRadius </td>
<td> <b>{number}</b> barBorderRadius </td>
<td> 0 </td>
<td> 柱形图</td>
<td> 柱形边框圆角,单位px,默认为0 </td>
</tr>
<tr>
<td> <b>{number}</b> borderWidth </td>
<td> 1 </td>
<td> 柱形图,折线图(symbol),散点图(symbole),饼图,markPoint</td>
<td> 柱形边框线宽,单位px,默认为1 </td>
<td> <b>{number}</b> barBorderWidth </td>
<td> 0 </td>
<td> 柱形图</td>
<td> 柱形边框线宽,单位px,默认为0 </td>
</tr>
<tr>
<td> <b>{Object}</b> label </td>
Expand Down
4 changes: 2 additions & 2 deletions doc/example/theme/infographic.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ var theme = {
bar: {
itemStyle: {
normal: {
borderRadius: 0
barBorderRadius: 0
},
emphasis: {
borderRadius: 0
barBorderRadius: 0
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions doc/example/theme/macarons.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ var theme = {
bar: {
itemStyle: {
normal: {
borderRadius: 5
barBorderRadius: 5
},
emphasis: {
borderRadius: 5
barBorderRadius: 5
}
}
},
Expand Down
12 changes: 6 additions & 6 deletions doc/example/themeDesigner.html
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,9 @@ <h3><a href="../example/map.html" target="_blank">map(地图)</a></h3>
itemStyle: {
normal: {
// color: '各异',
borderColor: '#fff', // 柱条边线
borderRadius: 0, // 柱条边线圆角,单位px,默认为0
borderWidth: 1, // 柱条边线线宽,单位px,默认为1
barBorderColor: '#fff', // 柱条边线
barBorderRadius: 0, // 柱条边线圆角,单位px,默认为0
barBorderWidth: 1, // 柱条边线线宽,单位px,默认为1
label: {
show: false
// position: 默认自适应,水平布局为'top',垂直布局为'right',可选为
Expand All @@ -515,9 +515,9 @@ <h3><a href="../example/map.html" target="_blank">map(地图)</a></h3>
},
emphasis: {
// color: '各异',
borderColor: 'rgba(0,0,0,0)', // 柱条边线
borderRadius: 0, // 柱条边线圆角,单位px,默认为0
borderWidth: 1, // 柱条边线线宽,单位px,默认为1
barBorderColor: 'rgba(0,0,0,0)', // 柱条边线
barBorderRadius: 0, // 柱条边线圆角,单位px,默认为0
barBorderWidth: 1, // 柱条边线线宽,单位px,默认为1
label: {
show: false
// position: 默认自适应,水平布局为'top',垂直布局为'right',可选为
Expand Down
16 changes: 8 additions & 8 deletions src/chart/bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ define(function (require) {
iconShape = legend.getItemShape(serieName);
if (iconShape) {
// 回调legend,换一个更形象的icon
if (serie.itemStyle.normal.borderWidth > 0) {
if (serie.itemStyle.normal.barBorderWidth > 0) {
iconShape.style.x += 1;
iconShape.style.y += 1;
iconShape.style.width -= 2;
iconShape.style.height -= 2;
iconShape.style.strokeColor =
iconShape.highlightStyle.strokeColor =
serie.itemStyle.normal.borderColor;
serie.itemStyle.normal.barBorderColor;
iconShape.highlightStyle.lineWidth = 3;
iconShape.style.brushType = 'both';
}
Expand Down Expand Up @@ -795,7 +795,7 @@ define(function (require) {
queryTarget,
'itemStyle.normal'
);
var normalBorderWidth = normal.borderWidth;
var normalBorderWidth = normal.barBorderWidth;
var emphasis = this.deepMerge(
queryTarget,
'itemStyle.emphasis'
Expand All @@ -810,15 +810,15 @@ define(function (require) {
height : height,
brushType : 'both',
color : this.getItemStyleColor(normalColor, seriesIndex, dataIndex, data),
radius : normal.borderRadius,
radius : normal.barBorderRadius,
lineWidth : normalBorderWidth,
strokeColor : normal.borderColor
strokeColor : normal.barBorderColor
},
highlightStyle : {
color : this.getItemStyleColor(emphasisColor, seriesIndex, dataIndex, data),
radius : emphasis.borderRadius,
lineWidth : emphasis.borderWidth,
strokeColor : emphasis.borderColor
radius : emphasis.barBorderRadius,
lineWidth : emphasis.barBorderWidth,
strokeColor : emphasis.barBorderColor
},
_orient : orient
};
Expand Down
12 changes: 6 additions & 6 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,9 @@ define(function() {
itemStyle: {
normal: {
// color: '各异',
borderColor: '#fff', // 柱条边线
borderRadius: 0, // 柱条边线圆角,单位px,默认为0
borderWidth: 0, // 柱条边线线宽,单位px,默认为1
barBorderColor: '#fff', // 柱条边线
barBorderRadius: 0, // 柱条边线圆角,单位px,默认为0
barBorderWidth: 0, // 柱条边线线宽,单位px,默认为1
label: {
show: false
// formatter: 标签文本格式器,同Tooltip.formatter,不支持回调
Expand All @@ -527,9 +527,9 @@ define(function() {
},
emphasis: {
// color: '各异',
borderColor: '#fff', // 柱条边线
borderRadius: 0, // 柱条边线圆角,单位px,默认为0
borderWidth: 0, // 柱条边线线宽,单位px,默认为1
barBorderColor: '#fff', // 柱条边线
barBorderRadius: 0, // 柱条边线圆角,单位px,默认为0
barBorderWidth: 0, // 柱条边线线宽,单位px,默认为1
label: {
show: false
// formatter: 标签文本格式器,同Tooltip.formatter,不支持回调
Expand Down

1 comment on commit 4895ec9

@kener
Copy link
Contributor Author

@kener kener commented on 4895ec9 Sep 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed #622

Please sign in to comment.