Skip to content

Commit

Permalink
feat: 柱状图/折线图新增维度轴分隔线设置
Browse files Browse the repository at this point in the history
  • Loading branch information
liweina committed Mar 18, 2021
1 parent 3e48792 commit f103cf5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion docs/chart-bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -710,4 +710,5 @@
| yAxisLineShow | 纵坐标轴轴线显隐| Boolean/Array | `true`/`false`| 默认 `true` |
| xAxisLabelShow | 横坐标轴刻度标签显隐| Boolean | `true`/`false`| 默认 `true` |
| xAxisLabelColor | 横坐标轴刻度标签文字颜色| String | - | 默认 null |
| xAxisLineShow | 横坐标轴轴线显隐| Boolean | `true`/`false`| 默认 `true` |
| xAxisLineShow | 横坐标轴轴线显隐| Boolean | `true`/`false`| 默认 `true` |
| xAxisSplitLine | 坐标轴分隔线| Object | - | 默认不显示 | https://echarts.apache.org/zh/option.html#xAxis.splitLine |
1 change: 1 addition & 0 deletions docs/chart-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,4 +449,5 @@
| xAxisLineShow | 横坐标轴轴线显隐| Boolean | `true`/`false`| 默认 `true` |
| xAxisInverse | X轴方向反向| Boolean | `true`/`false` | 默认 `false` 参见[文档](https://www.echartsjs.com/zh/option.html#xAxis.inverse) |
| yAxisInverse | Y轴方向反向| Boolean | `true`/`false` | 默认 `false` 参见[文档](https://www.echartsjs.com/zh/option.html#yAxis.inverse) |
| xAxisSplitLine | 坐标轴分隔线| Object | - | 默认不显示 | https://echarts.apache.org/zh/option.html#xAxis.splitLine |

6 changes: 5 additions & 1 deletion src/packages/bar/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class BarChart extends BaseChart {

// build dimension Axis
static getBarDimAxis (settings) {
const { dimAxisType, dimAxisLineShow, dimAxisLabelShow, dimAxisLabelColor, xAxisName } = settings
const { dimAxisType, dimAxisLineShow, dimAxisLabelShow, dimAxisLabelColor, xAxisName, xAxisSplitLine } = settings

const axisItem = {
type: dimAxisType,
Expand All @@ -69,6 +69,10 @@ class BarChart extends BaseChart {
axisItem.name = xAxisName
}

if (xAxisSplitLine) {
axisItem.splitLine = xAxisSplitLine
}

const disAxis = []
disAxis.push(axisItem)
return disAxis
Expand Down
5 changes: 3 additions & 2 deletions src/packages/line/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LineChart extends BaseChart {
}

static getLineDimAxis ({ settings }) {
const { yAxisType, xAxisLabelShow = true, xAxisLineShow = true, xAxisLabelColor, xAxisInverse = false, xAxisName } = settings
const { yAxisType, xAxisLabelShow = true, xAxisLineShow = true, xAxisLabelColor, xAxisInverse = false, xAxisName, xAxisSplitLine } = settings
const type = yAxisType || 'category'
return {
type,
Expand All @@ -43,7 +43,8 @@ class LineChart extends BaseChart {
color: xAxisLabelColor || null
},
inverse: xAxisInverse,
name: xAxisName !== undefined ? xAxisName : null
name: xAxisName !== undefined ? xAxisName : null,
splitLine: xAxisSplitLine !== undefined ? xAxisSplitLine : null
}
}

Expand Down

0 comments on commit f103cf5

Please sign in to comment.