UNPKG

nuke-biz-qn-chart

Version:

weex 版本千牛业务图表库,基于weex + rax,包含线图、柱状图、饼图、雷达图等,其他类型的图表正在按业务需求陆续接入。其中 native 端由客户端插件实现,h5 端使用 g2-mobile

87 lines (84 loc) 2.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getWidthAndHeight = getWidthAndHeight; exports.getXAxisCfg = getXAxisCfg; exports.getLeftAxisHorizontalCfg = getLeftAxisHorizontalCfg; exports.getLeftAxisCfg = getLeftAxisCfg; function getWidthAndHeight(props) { var width = void 0, height = void 0; if (props.width) { width = props.width; } else if (props.style && props.style.width) { width = props.style.width; } if (props.height) { height = props.height; } else if (props.style && props.style.height) { height = props.style.height; } var style = { width: width, height: height }; return style; } var defaultOptions = { color: "#37474f", fontSize: 9, position: "bottom" /** * x 轴通用配置 * @param {[type]} xAxis [description] * @return {[type]} [description] */ };function getXAxisCfg(xAxis) { return { drawAxisLine: xAxis.show || false, drawLabels: true, drawGridLines: false, textColor: xAxis.color || defaultOptions.color, textSize: xAxis.fontSize || defaultOptions.fontSize, position: xAxis.position || defaultOptions.position }; } /** * 横向柱状图,左 轴(x轴)左侧 配置 * @param {[type]} xAxis [description] * @return {[type]} [description] */ function getLeftAxisHorizontalCfg(xAxis) { return { drawLabels: false, drawGridLines: true, gridColor: "#dddddd", gridLineWidth: 1, textColor: xAxis.color || defaultOptions.color, textSize: xAxis.fontSize || defaultOptions.fontSize, position: "OUTSIDE_CHART", spaceTop: 15 }; } /** * y 轴左侧 通用配置 * @param {[type]} xAxis [description] * @return {[type]} [description] */ function getLeftAxisCfg(yAxis, grids, showYAxis) { return { drawAxisLine: yAxis.show || true, drawLabels: yAxis.show || true, gridLineSpaceLeft: 1, gridLineSpaceRight: 0, enabled: showYAxis, drawGridLines: true, gridColor: grids.color || "#eeeeee", gridLineWidth: grids.lineWidth || 1, textColor: yAxis.color || defaultOptions.color, textSize: yAxis.fontSize || defaultOptions.fontSize, position: "OUTSIDE_CHART", spaceTop: 15 }; }