@easyv/config
Advanced tools
Comparing version 1.0.26 to 1.0.27
211
lib/axes.js
@@ -14,2 +14,4 @@ "use strict"; | ||
var _label = require("./label"); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
@@ -118,5 +120,5 @@ | ||
var _ref$label$format$typ = _ref$label$format.type, | ||
labelType = _ref$label$format$typ === void 0 ? defaultCategoryAxis.label.format.type : _ref$label$format$typ, | ||
type = _ref$label$format$typ === void 0 ? defaultCategoryAxis.label.format.type : _ref$label$format$typ, | ||
_ref$label$format$sho = _ref$label$format.showType, | ||
labelShowType = _ref$label$format$sho === void 0 ? defaultCategoryAxis.label.format.showType : _ref$label$format$sho, | ||
showType = _ref$label$format$sho === void 0 ? defaultCategoryAxis.label.format.showType : _ref$label$format$sho, | ||
_ref$label$appearance = _ref$label.appearance; | ||
@@ -137,3 +139,3 @@ _ref$label$appearance = _ref$label$appearance === void 0 ? defaultCategoryAxis.label.appearance : _ref$label$appearance; | ||
_ref$label$font = _ref$label.font, | ||
font = _ref$label$font === void 0 ? defaultCategoryAxis.label.font : _ref$label$font, | ||
labelFont = _ref$label$font === void 0 ? defaultCategoryAxis.label.font : _ref$label$font, | ||
_ref$axisLine = _ref.axisLine; | ||
@@ -172,189 +174,22 @@ _ref$axisLine = _ref$axisLine === void 0 ? defaultCategoryAxis.axisLine : _ref$axisLine; | ||
type: 'boolean' | ||
}, { | ||
rule: [['on', '$eq', true]], | ||
name: 'label', | ||
displayName: '轴标签', | ||
value: [{ | ||
name: 'show', | ||
displayName: '显示', | ||
value: showLabel, | ||
type: 'boolean' | ||
}, { | ||
rule: [['show', '$eq', true]], | ||
name: 'format', | ||
displayName: '格式', | ||
value: [{ | ||
name: 'type', | ||
displayName: '', | ||
value: labelType, | ||
type: 'radio', | ||
config: { | ||
options: [{ | ||
name: '类目型', | ||
value: 'category' | ||
}, { | ||
name: '时间型', | ||
value: 'date' | ||
}], | ||
span: 24 | ||
} | ||
}, { | ||
rule: [['type', '$eq', 'date']], | ||
name: 'showType', | ||
displayName: '', | ||
value: labelShowType, | ||
type: 'select', | ||
config: { | ||
options: [{ | ||
name: '2017年1月1日 08:00:00', | ||
value: 'YYYY年M月D日 HH:mm:ss' | ||
}, { | ||
name: '2017年01月01日 08:00:00', | ||
value: 'YYYY年MM月DD日 HH:mm:ss' | ||
}, { | ||
name: '2017-1-1 08:00:00', | ||
value: 'YYYY-M-D HH:mm:ss' | ||
}, { | ||
name: '2017-01-01 08:00:00', | ||
value: 'YYYY-MM-DD HH:mm:ss' | ||
}, { | ||
name: '2017.1.1 08:00:00', | ||
value: 'YYYY.M.D HH:mm:ss' | ||
}, { | ||
name: '2017.01.01 08:00:00', | ||
value: 'YYYY.MM.DD HH:mm:ss' | ||
}, { | ||
name: '2017年1月1日', | ||
value: 'YYYY年M月D日' | ||
}, { | ||
name: '2017年01月01日', | ||
value: 'YYYY年MM月DD日' | ||
}, { | ||
name: '2017年01月', | ||
value: 'YYYY年MM月' | ||
}, { | ||
name: '2017-1-1', | ||
value: 'YYYY-M-D' | ||
}, { | ||
name: '2017-01-01', | ||
value: 'YYYY-MM-DD' | ||
}, { | ||
name: '2017.1.1', | ||
value: 'YYYY.M.D' | ||
}, { | ||
name: '2017.01.01', | ||
value: 'YYYY.MM.DD' | ||
}, { | ||
name: '1月1日', | ||
value: 'M月D日' | ||
}, { | ||
name: '01月01日', | ||
value: 'MM月DD日' | ||
}, { | ||
name: '01月01日01时', | ||
value: 'MM月DD日HH时' | ||
}, { | ||
name: '1-1', | ||
value: 'M-D' | ||
}, { | ||
name: '01-01', | ||
value: 'MM-DD' | ||
}, { | ||
name: '1.1', | ||
value: 'M.D' | ||
}, { | ||
name: '01.01', | ||
value: 'MM.DD' | ||
}, { | ||
name: '1月', | ||
value: 'M月' | ||
}, { | ||
name: '01月', | ||
value: 'MM月' | ||
}, { | ||
name: '1(月)', | ||
value: 'M' | ||
}, { | ||
name: '01(月)', | ||
value: 'MM' | ||
}, { | ||
name: '1日', | ||
value: 'D日' | ||
}, { | ||
name: '01日', | ||
value: 'DD日' | ||
}, { | ||
name: '1(日)', | ||
value: 'D' | ||
}, { | ||
name: '01(日)', | ||
value: 'DD' | ||
}, { | ||
name: '08:00:00', | ||
value: 'HH:mm:ss' | ||
}, { | ||
name: '08:00', | ||
value: 'HH:mm' | ||
}, { | ||
name: '星期一', | ||
value: 'X' | ||
}, { | ||
name: 'Monday', | ||
value: 'W' | ||
}, { | ||
name: 'Mon', | ||
value: 'w' | ||
}], | ||
span: 24 | ||
} | ||
}], | ||
type: 'group' | ||
}, { | ||
rule: [['show', '$eq', true]], | ||
name: 'appearance', | ||
displayName: '展示', | ||
value: [{ | ||
name: 'count', | ||
displayName: '标签数量', | ||
value: count, | ||
type: 'number', | ||
config: { | ||
min: 2, | ||
span: 12 | ||
} | ||
}, { | ||
name: 'angle', | ||
displayName: '文字角度', | ||
value: angle, | ||
type: 'number', | ||
config: { | ||
span: 12, | ||
suffix: '°' | ||
} | ||
}, { | ||
name: 'wordBreak', | ||
displayName: '行字数限制', | ||
value: wordBreak, | ||
type: 'select', | ||
config: { | ||
options: [{ | ||
name: '不限制', | ||
value: 'keep-all' | ||
}], | ||
allowInput: true, | ||
span: 12 | ||
} | ||
}], | ||
type: 'group' | ||
}, _objectSpread({ | ||
rule: [['show', '$eq', true]] | ||
}, (0, _.translate)(labelTranslateX, labelTranslateY)), { | ||
rule: [['show', '$eq', true]], | ||
name: 'font', | ||
displayName: '文本样式', | ||
value: font, | ||
type: 'textStyle' | ||
}] | ||
}, _objectSpread({ | ||
rule: [['on', '$eq', true]] | ||
}, (0, _label.axisLabel)({ | ||
show: showLabel, | ||
format: { | ||
type: type, | ||
showType: showType | ||
}, | ||
appearance: { | ||
count: count, | ||
angle: angle, | ||
wordBreak: wordBreak | ||
}, | ||
translate: { | ||
x: labelTranslateX, | ||
y: labelTranslateY | ||
}, | ||
font: labelFont | ||
})), _objectSpread({ | ||
rule: [['on', '$eq', true]] | ||
}, (0, _.axisLine)({ | ||
@@ -361,0 +196,0 @@ show: showAxis, |
@@ -94,2 +94,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "axisLabel", { | ||
enumerable: true, | ||
get: function get() { | ||
return _label.axisLabel; | ||
} | ||
}); | ||
Object.defineProperty(exports, "legend", { | ||
@@ -96,0 +102,0 @@ enumerable: true, |
239
lib/label.js
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.labelOfPie = exports["default"] = void 0; | ||
exports.axisLabel = exports.labelOfPie = exports["default"] = void 0; | ||
@@ -327,2 +327,237 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
exports.labelOfPie = labelOfPie; | ||
exports.labelOfPie = labelOfPie; | ||
var defaultAxisLabel = { | ||
show: true, | ||
format: { | ||
type: 'date', | ||
showType: 'MM月' | ||
}, | ||
appearance: { | ||
count: 3, | ||
angle: 0, | ||
wordBreak: 'keep-all' | ||
}, | ||
translate: { | ||
x: 0, | ||
y: 0 | ||
}, | ||
font: (0, _.font)({ | ||
color: 'rgba(230, 247, 255, 1)' | ||
}) | ||
}; | ||
var axisLabel = function axisLabel() { | ||
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultAxisLabel, | ||
_ref3$show = _ref3.show, | ||
showLabel = _ref3$show === void 0 ? defaultAxisLabel.show : _ref3$show, | ||
_ref3$format = _ref3.format; | ||
_ref3$format = _ref3$format === void 0 ? defaultAxisLabel.format : _ref3$format; | ||
var _ref3$format$type = _ref3$format.type, | ||
labelType = _ref3$format$type === void 0 ? defaultAxisLabel.format.type : _ref3$format$type, | ||
_ref3$format$showType = _ref3$format.showType, | ||
labelShowType = _ref3$format$showType === void 0 ? defaultAxisLabel.format.showType : _ref3$format$showType, | ||
_ref3$appearance = _ref3.appearance; | ||
_ref3$appearance = _ref3$appearance === void 0 ? defaultAxisLabel.appearance : _ref3$appearance; | ||
var _ref3$appearance$coun = _ref3$appearance.count, | ||
count = _ref3$appearance$coun === void 0 ? defaultAxisLabel.appearance.count : _ref3$appearance$coun, | ||
_ref3$appearance$angl = _ref3$appearance.angle, | ||
angle = _ref3$appearance$angl === void 0 ? defaultAxisLabel.appearance.angle : _ref3$appearance$angl, | ||
_ref3$appearance$word = _ref3$appearance.wordBreak, | ||
wordBreak = _ref3$appearance$word === void 0 ? defaultAxisLabel.appearance.wordBreak : _ref3$appearance$word, | ||
_ref3$translate = _ref3.translate; | ||
_ref3$translate = _ref3$translate === void 0 ? defaultAxisLabel.translate : _ref3$translate; | ||
var _ref3$translate$x = _ref3$translate.x, | ||
labelTranslateX = _ref3$translate$x === void 0 ? defaultAxisLabel.translate.x : _ref3$translate$x, | ||
_ref3$translate$y = _ref3$translate.y, | ||
labelTranslateY = _ref3$translate$y === void 0 ? defaultAxisLabel.translate.y : _ref3$translate$y, | ||
_ref3$font = _ref3.font, | ||
font = _ref3$font === void 0 ? defaultAxisLabel.font : _ref3$font; | ||
return { | ||
name: 'label', | ||
displayName: '轴标签', | ||
value: [{ | ||
name: 'show', | ||
displayName: '显示', | ||
value: showLabel, | ||
type: 'boolean' | ||
}, { | ||
rule: [['show', '$eq', true]], | ||
name: 'format', | ||
displayName: '格式', | ||
value: [{ | ||
name: 'type', | ||
displayName: '', | ||
value: labelType, | ||
type: 'radio', | ||
config: { | ||
options: [{ | ||
name: '类目型', | ||
value: 'category' | ||
}, { | ||
name: '时间型', | ||
value: 'date' | ||
}], | ||
span: 24 | ||
} | ||
}, { | ||
rule: [['type', '$eq', 'date']], | ||
name: 'showType', | ||
displayName: '', | ||
value: labelShowType, | ||
type: 'select', | ||
config: { | ||
options: [{ | ||
name: '2017年1月1日 08:00:00', | ||
value: 'YYYY年M月D日 HH:mm:ss' | ||
}, { | ||
name: '2017年01月01日 08:00:00', | ||
value: 'YYYY年MM月DD日 HH:mm:ss' | ||
}, { | ||
name: '2017-1-1 08:00:00', | ||
value: 'YYYY-M-D HH:mm:ss' | ||
}, { | ||
name: '2017-01-01 08:00:00', | ||
value: 'YYYY-MM-DD HH:mm:ss' | ||
}, { | ||
name: '2017.1.1 08:00:00', | ||
value: 'YYYY.M.D HH:mm:ss' | ||
}, { | ||
name: '2017.01.01 08:00:00', | ||
value: 'YYYY.MM.DD HH:mm:ss' | ||
}, { | ||
name: '2017年1月1日', | ||
value: 'YYYY年M月D日' | ||
}, { | ||
name: '2017年01月01日', | ||
value: 'YYYY年MM月DD日' | ||
}, { | ||
name: '2017年01月', | ||
value: 'YYYY年MM月' | ||
}, { | ||
name: '2017-1-1', | ||
value: 'YYYY-M-D' | ||
}, { | ||
name: '2017-01-01', | ||
value: 'YYYY-MM-DD' | ||
}, { | ||
name: '2017.1.1', | ||
value: 'YYYY.M.D' | ||
}, { | ||
name: '2017.01.01', | ||
value: 'YYYY.MM.DD' | ||
}, { | ||
name: '1月1日', | ||
value: 'M月D日' | ||
}, { | ||
name: '01月01日', | ||
value: 'MM月DD日' | ||
}, { | ||
name: '01月01日01时', | ||
value: 'MM月DD日HH时' | ||
}, { | ||
name: '1-1', | ||
value: 'M-D' | ||
}, { | ||
name: '01-01', | ||
value: 'MM-DD' | ||
}, { | ||
name: '1.1', | ||
value: 'M.D' | ||
}, { | ||
name: '01.01', | ||
value: 'MM.DD' | ||
}, { | ||
name: '1月', | ||
value: 'M月' | ||
}, { | ||
name: '01月', | ||
value: 'MM月' | ||
}, { | ||
name: '1(月)', | ||
value: 'M' | ||
}, { | ||
name: '01(月)', | ||
value: 'MM' | ||
}, { | ||
name: '1日', | ||
value: 'D日' | ||
}, { | ||
name: '01日', | ||
value: 'DD日' | ||
}, { | ||
name: '1(日)', | ||
value: 'D' | ||
}, { | ||
name: '01(日)', | ||
value: 'DD' | ||
}, { | ||
name: '08:00:00', | ||
value: 'HH:mm:ss' | ||
}, { | ||
name: '08:00', | ||
value: 'HH:mm' | ||
}, { | ||
name: '星期一', | ||
value: 'X' | ||
}, { | ||
name: 'Monday', | ||
value: 'W' | ||
}, { | ||
name: 'Mon', | ||
value: 'w' | ||
}], | ||
span: 24 | ||
} | ||
}], | ||
type: 'group' | ||
}, { | ||
rule: [['show', '$eq', true]], | ||
name: 'appearance', | ||
displayName: '展示', | ||
value: [{ | ||
name: 'count', | ||
displayName: '标签数量', | ||
value: count, | ||
type: 'number', | ||
config: { | ||
min: 2, | ||
span: 12 | ||
} | ||
}, { | ||
name: 'angle', | ||
displayName: '文字角度', | ||
value: angle, | ||
type: 'number', | ||
config: { | ||
span: 12, | ||
suffix: '°' | ||
} | ||
}, { | ||
name: 'wordBreak', | ||
displayName: '行字数限制', | ||
value: wordBreak, | ||
type: 'select', | ||
config: { | ||
options: [{ | ||
name: '不限制', | ||
value: 'keep-all' | ||
}], | ||
allowInput: true, | ||
span: 12 | ||
} | ||
}], | ||
type: 'group' | ||
}, _objectSpread({ | ||
rule: [['show', '$eq', true]] | ||
}, (0, _.translate)(labelTranslateX, labelTranslateY)), { | ||
rule: [['show', '$eq', true]], | ||
name: 'font', | ||
displayName: '文本样式', | ||
value: font, | ||
type: 'textStyle' | ||
}] | ||
}; | ||
}; | ||
exports.axisLabel = axisLabel; |
{ | ||
"name": "@easyv/config", | ||
"version": "1.0.26", | ||
"version": "1.0.27", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
261
src/axes.js
import { gridLine, tickLine, axisLine, extent, unit, translate, font } from '.'; | ||
import { axisLabel } from './label'; | ||
const defaultFont = font(); | ||
@@ -69,16 +70,16 @@ const defaultFontAxisY = font({ | ||
show: showLabel = defaultCategoryAxis.label.show, | ||
format: { | ||
type: labelType = defaultCategoryAxis.label.format.type, | ||
showType: labelShowType = defaultCategoryAxis.label.format.showType, | ||
format: { | ||
type = defaultCategoryAxis.label.format.type, | ||
showType = defaultCategoryAxis.label.format.showType | ||
} = defaultCategoryAxis.label.format, | ||
appearance: { | ||
count = defaultCategoryAxis.label.appearance.count, | ||
angle = defaultCategoryAxis.label.appearance.angle, | ||
wordBreak = defaultCategoryAxis.label.appearance.wordBreak, | ||
appearance: { | ||
count = defaultCategoryAxis.label.appearance.count, | ||
angle = defaultCategoryAxis.label.appearance.angle, | ||
wordBreak = defaultCategoryAxis.label.appearance.wordBreak | ||
} = defaultCategoryAxis.label.appearance, | ||
translate: { | ||
x: labelTranslateX = defaultCategoryAxis.label.translate.x, | ||
y: labelTranslateY = defaultCategoryAxis.label.translate.y, | ||
translate: { | ||
x: labelTranslateX = defaultCategoryAxis.label.translate.x, | ||
y: labelTranslateY = defaultCategoryAxis.label.translate.y | ||
} = defaultCategoryAxis.label.translate, | ||
font = defaultCategoryAxis.label.font, | ||
font: labelFont = defaultCategoryAxis.label.font, | ||
} = defaultCategoryAxis.label, | ||
@@ -112,233 +113,9 @@ axisLine: { | ||
rule: [['on', '$eq', true]], | ||
name: 'label', | ||
displayName: '轴标签', | ||
value: [ | ||
{ | ||
name: 'show', | ||
displayName: '显示', | ||
value: showLabel, | ||
type: 'boolean', | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
name: 'format', | ||
displayName: '格式', | ||
value: [ | ||
{ | ||
name: 'type', | ||
displayName: '', | ||
value: labelType, | ||
type: 'radio', | ||
config: { | ||
options: [ | ||
{ | ||
name: '类目型', | ||
value: 'category', | ||
}, | ||
{ | ||
name: '时间型', | ||
value: 'date', | ||
}, | ||
], | ||
span: 24, | ||
}, | ||
}, | ||
{ | ||
rule: [['type', '$eq', 'date']], | ||
name: 'showType', | ||
displayName: '', | ||
value: labelShowType, | ||
type: 'select', | ||
config: { | ||
options: [ | ||
{ | ||
name: '2017年1月1日 08:00:00', | ||
value: 'YYYY年M月D日 HH:mm:ss', | ||
}, | ||
{ | ||
name: '2017年01月01日 08:00:00', | ||
value: 'YYYY年MM月DD日 HH:mm:ss', | ||
}, | ||
{ | ||
name: '2017-1-1 08:00:00', | ||
value: 'YYYY-M-D HH:mm:ss', | ||
}, | ||
{ | ||
name: '2017-01-01 08:00:00', | ||
value: 'YYYY-MM-DD HH:mm:ss', | ||
}, | ||
{ | ||
name: '2017.1.1 08:00:00', | ||
value: 'YYYY.M.D HH:mm:ss', | ||
}, | ||
{ | ||
name: '2017.01.01 08:00:00', | ||
value: 'YYYY.MM.DD HH:mm:ss', | ||
}, | ||
{ | ||
name: '2017年1月1日', | ||
value: 'YYYY年M月D日', | ||
}, | ||
{ | ||
name: '2017年01月01日', | ||
value: 'YYYY年MM月DD日', | ||
}, | ||
{ | ||
name: '2017年01月', | ||
value: 'YYYY年MM月', | ||
}, | ||
{ | ||
name: '2017-1-1', | ||
value: 'YYYY-M-D', | ||
}, | ||
{ | ||
name: '2017-01-01', | ||
value: 'YYYY-MM-DD', | ||
}, | ||
{ | ||
name: '2017.1.1', | ||
value: 'YYYY.M.D', | ||
}, | ||
{ | ||
name: '2017.01.01', | ||
value: 'YYYY.MM.DD', | ||
}, | ||
{ | ||
name: '1月1日', | ||
value: 'M月D日', | ||
}, | ||
{ | ||
name: '01月01日', | ||
value: 'MM月DD日', | ||
}, | ||
{ | ||
name: '01月01日01时', | ||
value: 'MM月DD日HH时', | ||
}, | ||
{ | ||
name: '1-1', | ||
value: 'M-D', | ||
}, | ||
{ | ||
name: '01-01', | ||
value: 'MM-DD', | ||
}, | ||
{ | ||
name: '1.1', | ||
value: 'M.D', | ||
}, | ||
{ | ||
name: '01.01', | ||
value: 'MM.DD', | ||
}, | ||
{ | ||
name: '1月', | ||
value: 'M月', | ||
}, | ||
{ | ||
name: '01月', | ||
value: 'MM月', | ||
}, | ||
{ | ||
name: '1(月)', | ||
value: 'M', | ||
}, | ||
{ | ||
name: '01(月)', | ||
value: 'MM', | ||
}, | ||
{ | ||
name: '1日', | ||
value: 'D日', | ||
}, | ||
{ | ||
name: '01日', | ||
value: 'DD日', | ||
}, | ||
{ | ||
name: '1(日)', | ||
value: 'D', | ||
}, | ||
{ | ||
name: '01(日)', | ||
value: 'DD', | ||
}, | ||
{ | ||
name: '08:00:00', | ||
value: 'HH:mm:ss', | ||
}, | ||
{ | ||
name: '08:00', | ||
value: 'HH:mm', | ||
}, | ||
{ | ||
name: '星期一', | ||
value: 'X', | ||
}, | ||
{ | ||
name: 'Monday', | ||
value: 'W', | ||
}, | ||
{ | ||
name: 'Mon', | ||
value: 'w', | ||
}, | ||
], | ||
span: 24, | ||
}, | ||
}, | ||
], | ||
type: 'group', | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
name: 'appearance', | ||
displayName: '展示', | ||
value: [ | ||
{ | ||
name: 'count', | ||
displayName: '标签数量', | ||
value: count, | ||
type: 'number', | ||
config: { | ||
min: 2, | ||
span: 12, | ||
}, | ||
}, | ||
{ | ||
name: 'angle', | ||
displayName: '文字角度', | ||
value: angle, | ||
type: 'number', | ||
config: { | ||
span: 12, | ||
suffix: '°', | ||
}, | ||
}, | ||
{ | ||
name: 'wordBreak', | ||
displayName: '行字数限制', | ||
value: wordBreak, | ||
type: 'select', | ||
config: { | ||
options: [{ name: '不限制', value: 'keep-all' }], | ||
allowInput: true, | ||
span: 12, | ||
}, | ||
}, | ||
], | ||
type: 'group', | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
...translate(labelTranslateX, labelTranslateY), | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
name: 'font', | ||
displayName: '文本样式', | ||
value: font, | ||
type: 'textStyle', | ||
}, | ||
], | ||
...axisLabel({ | ||
show:showLabel, | ||
format: { type: type, showType: showType }, | ||
appearance: { count: count, angle: angle, wordBreak: wordBreak }, | ||
translate: { x: labelTranslateX, y: labelTranslateY }, | ||
font: labelFont, | ||
}), | ||
}, | ||
@@ -345,0 +122,0 @@ { |
@@ -12,3 +12,3 @@ import show from './show'; | ||
import dimension from './dimension'; | ||
import label, { labelOfPie } from './label'; | ||
import label, { labelOfPie, axisLabel } from './label'; | ||
import legend, { legendOfPie } from './legend'; | ||
@@ -51,2 +51,3 @@ import tooltip from './tooltip'; | ||
labelOfPie, | ||
axisLabel, | ||
pie, | ||
@@ -53,0 +54,0 @@ rosePie, |
257
src/label.js
@@ -285,1 +285,258 @@ import { translate, font } from '.'; | ||
}); | ||
const defaultAxisLabel = { | ||
show: true, | ||
format: { type: 'date', showType: 'MM月' }, | ||
appearance: { count: 3, angle: 0, wordBreak: 'keep-all' }, | ||
translate: { x: 0, y: 0 }, | ||
font: font({color: 'rgba(230, 247, 255, 1)',}) | ||
} | ||
export const axisLabel = ({ | ||
show: showLabel = defaultAxisLabel.show, | ||
format: { | ||
type: labelType = defaultAxisLabel.format.type, | ||
showType: labelShowType = defaultAxisLabel.format.showType, | ||
} = defaultAxisLabel.format, | ||
appearance: { | ||
count = defaultAxisLabel.appearance.count, | ||
angle = defaultAxisLabel.appearance.angle, | ||
wordBreak = defaultAxisLabel.appearance.wordBreak, | ||
} = defaultAxisLabel.appearance, | ||
translate: { | ||
x: labelTranslateX = defaultAxisLabel.translate.x, | ||
y: labelTranslateY = defaultAxisLabel.translate.y, | ||
} = defaultAxisLabel.translate, | ||
font = defaultAxisLabel.font, | ||
} = defaultAxisLabel) => ({ | ||
name: 'label', | ||
displayName: '轴标签', | ||
value: [ | ||
{ | ||
name: 'show', | ||
displayName: '显示', | ||
value: showLabel, | ||
type: 'boolean', | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
name: 'format', | ||
displayName: '格式', | ||
value: [ | ||
{ | ||
name: 'type', | ||
displayName: '', | ||
value: labelType, | ||
type: 'radio', | ||
config: { | ||
options: [ | ||
{ | ||
name: '类目型', | ||
value: 'category', | ||
}, | ||
{ | ||
name: '时间型', | ||
value: 'date', | ||
}, | ||
], | ||
span: 24, | ||
}, | ||
}, | ||
{ | ||
rule: [['type', '$eq', 'date']], | ||
name: 'showType', | ||
displayName: '', | ||
value: labelShowType, | ||
type: 'select', | ||
config: { | ||
options: [ | ||
{ | ||
name: '2017年1月1日 08:00:00', | ||
value: 'YYYY年M月D日 HH:mm:ss', | ||
}, | ||
{ | ||
name: '2017年01月01日 08:00:00', | ||
value: 'YYYY年MM月DD日 HH:mm:ss', | ||
}, | ||
{ | ||
name: '2017-1-1 08:00:00', | ||
value: 'YYYY-M-D HH:mm:ss', | ||
}, | ||
{ | ||
name: '2017-01-01 08:00:00', | ||
value: 'YYYY-MM-DD HH:mm:ss', | ||
}, | ||
{ | ||
name: '2017.1.1 08:00:00', | ||
value: 'YYYY.M.D HH:mm:ss', | ||
}, | ||
{ | ||
name: '2017.01.01 08:00:00', | ||
value: 'YYYY.MM.DD HH:mm:ss', | ||
}, | ||
{ | ||
name: '2017年1月1日', | ||
value: 'YYYY年M月D日', | ||
}, | ||
{ | ||
name: '2017年01月01日', | ||
value: 'YYYY年MM月DD日', | ||
}, | ||
{ | ||
name: '2017年01月', | ||
value: 'YYYY年MM月', | ||
}, | ||
{ | ||
name: '2017-1-1', | ||
value: 'YYYY-M-D', | ||
}, | ||
{ | ||
name: '2017-01-01', | ||
value: 'YYYY-MM-DD', | ||
}, | ||
{ | ||
name: '2017.1.1', | ||
value: 'YYYY.M.D', | ||
}, | ||
{ | ||
name: '2017.01.01', | ||
value: 'YYYY.MM.DD', | ||
}, | ||
{ | ||
name: '1月1日', | ||
value: 'M月D日', | ||
}, | ||
{ | ||
name: '01月01日', | ||
value: 'MM月DD日', | ||
}, | ||
{ | ||
name: '01月01日01时', | ||
value: 'MM月DD日HH时', | ||
}, | ||
{ | ||
name: '1-1', | ||
value: 'M-D', | ||
}, | ||
{ | ||
name: '01-01', | ||
value: 'MM-DD', | ||
}, | ||
{ | ||
name: '1.1', | ||
value: 'M.D', | ||
}, | ||
{ | ||
name: '01.01', | ||
value: 'MM.DD', | ||
}, | ||
{ | ||
name: '1月', | ||
value: 'M月', | ||
}, | ||
{ | ||
name: '01月', | ||
value: 'MM月', | ||
}, | ||
{ | ||
name: '1(月)', | ||
value: 'M', | ||
}, | ||
{ | ||
name: '01(月)', | ||
value: 'MM', | ||
}, | ||
{ | ||
name: '1日', | ||
value: 'D日', | ||
}, | ||
{ | ||
name: '01日', | ||
value: 'DD日', | ||
}, | ||
{ | ||
name: '1(日)', | ||
value: 'D', | ||
}, | ||
{ | ||
name: '01(日)', | ||
value: 'DD', | ||
}, | ||
{ | ||
name: '08:00:00', | ||
value: 'HH:mm:ss', | ||
}, | ||
{ | ||
name: '08:00', | ||
value: 'HH:mm', | ||
}, | ||
{ | ||
name: '星期一', | ||
value: 'X', | ||
}, | ||
{ | ||
name: 'Monday', | ||
value: 'W', | ||
}, | ||
{ | ||
name: 'Mon', | ||
value: 'w', | ||
}, | ||
], | ||
span: 24, | ||
}, | ||
}, | ||
], | ||
type: 'group', | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
name: 'appearance', | ||
displayName: '展示', | ||
value: [ | ||
{ | ||
name: 'count', | ||
displayName: '标签数量', | ||
value: count, | ||
type: 'number', | ||
config: { | ||
min: 2, | ||
span: 12, | ||
}, | ||
}, | ||
{ | ||
name: 'angle', | ||
displayName: '文字角度', | ||
value: angle, | ||
type: 'number', | ||
config: { | ||
span: 12, | ||
suffix: '°', | ||
}, | ||
}, | ||
{ | ||
name: 'wordBreak', | ||
displayName: '行字数限制', | ||
value: wordBreak, | ||
type: 'select', | ||
config: { | ||
options: [{ name: '不限制', value: 'keep-all' }], | ||
allowInput: true, | ||
span: 12, | ||
}, | ||
}, | ||
], | ||
type: 'group', | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
...translate(labelTranslateX, labelTranslateY), | ||
}, | ||
{ | ||
rule: [['show', '$eq', true]], | ||
name: 'font', | ||
displayName: '文本样式', | ||
value: font, | ||
type: 'textStyle', | ||
}, | ||
], | ||
}); |
221760
7564