feat: Add minAxisCount

This commit is contained in:
1ambda 2017-04-10 13:31:58 +09:00
parent 4887800b22
commit 5cf2eceeac
2 changed files with 17 additions and 3 deletions

View file

@ -139,7 +139,8 @@ class AwesomeVisualization extends Visualization {
|`axisType` | `group` | Column(s) in this axis will be used as `group` like in `PivotTransformation`. These columns will be served in `column.group` |
|`axisType` | (string) | Any string value can be used here. These columns will be served in `column.custom` |
|`valueType` | (string) | Describe the value type just for annotation |
|`maxAxisCount` | (int) | The maximum column count that this axis can contains. (unlimited if `undefined`) |
|`maxAxisCount` | (int) | The max number of columns that this axis can contain. (unlimited if `undefined`) |
|`minAxisCount` | (int) | The min number of columns that this axis should contain to draw chart. (`1` in case of single dimension) |
<br/>

View file

@ -101,8 +101,21 @@ export default class AdvancedTransformation extends Transformation {
getAxisTypeAnnotation: (axisSpec) => {
let anno = `${axisSpec.axisType}`
if (typeof axisSpec.maxAxisCount !== 'undefined') {
anno = `${anno} (${axisSpec.maxAxisCount})`
let minAxisCount = axisSpec.minAxisCount
let maxAxisCount = axisSpec.maxAxisCount
if (isSingleDimensionAxis(axisSpec)) {
maxAxisCount = 1
}
let comment = ''
if (minAxisCount) { comment = `min: ${minAxisCount}` }
if (minAxisCount && maxAxisCount) { comment = `${comment}, `}
if (maxAxisCount) { comment = `${comment}max: ${maxAxisCount}` }
if (comment !== '') {
anno = `${anno} (${comment})`
}
return anno