/* * << * Davinci * == * Copyright (C) 2016 - 2017 EDP * == * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * >> */ import React from 'react' import { Row, Col, Input, Checkbox, Select, InputNumber } from 'antd' const Option = Select.Option import ColorPicker from 'app/components/ColorPicker' import { PIVOT_CHART_FONT_FAMILIES, PIVOT_CHART_LINE_STYLES, PIVOT_CHART_FONT_SIZES, CHART_LABEL_POSITIONS, CHART_PIE_LABEL_POSITIONS, CHART_FUNNEL_LABEL_POSITIONS } from 'app/globalConstants' const styles = require('../Workbench.less') export interface IGaugeConfig { radius: number splitNumber: number startAngle: number endAngle: number clockwise: boolean max: number prefix: string suffix: string showTitle: boolean titleFontFamily: string titleFontSize: string titleColor: string titleOffsetLeft: number titleOffsetTop: number showDetail: boolean detailFontFamily: string detailFontSize: string detailColor: string detailOffsetLeft: number detailOffsetTop: number showPointer: boolean pointerLength: number pointerWidth: number customPointerColor: boolean pointerColor: string pointerBorderStyle: string pointerBorderWidth: number pointerBorderColor: string axisLineSize: number axisLineColor: string showAxisTick: boolean showAxisLabel: boolean axisLabelDistance: number axisLabelFontFamily: string axisLabelFontSize: string axisLabelColor: string showSplitLine: boolean splitLineLength: number splitLineSize: string splitLineStyle: string splitLineColor: string } interface IGaugeSectionProps { title: string config: IGaugeConfig onChange: (prop: string, value: any) => void } export class GaugeSection extends React.PureComponent { private inputChange = (prop) => (e: React.ChangeEvent) => { this.props.onChange(prop, e.target.value) } private checkboxChange = (prop) => (e) => { this.props.onChange(prop, e.target.checked) } private selectChange = (prop) => (value) => { this.props.onChange(prop, value) } private colorChange = (prop) => (color) => { this.props.onChange(prop, color) } private inputNumberChange = (prop) => (value) => { this.props.onChange(prop, value) } private percentFormatter = (value) => `${value}%` private percentParser = (value) => value.replace('%', '') private pixelFormatter = (value) => `${value}px` private pixelParser = (value) => value.replace(/[p|x]+/, '') private lineStyles = PIVOT_CHART_LINE_STYLES.map((l) => ( )) public render () { const { title, config } = this.props const { radius, splitNumber, startAngle, endAngle, clockwise, max, prefix, suffix, showTitle, titleFontFamily, titleFontSize, titleColor, titleOffsetLeft, titleOffsetTop, showDetail, detailFontFamily, detailFontSize, detailColor, detailOffsetLeft, detailOffsetTop, showPointer, pointerLength, pointerWidth, customPointerColor, pointerColor, pointerBorderStyle, pointerBorderWidth, pointerBorderColor, axisLineSize, axisLineColor, showAxisTick, showAxisLabel, axisLabelDistance, axisLabelFontFamily, axisLabelFontSize, axisLabelColor, showSplitLine, splitLineLength, splitLineSize, splitLineStyle, splitLineColor } = config const fontFamilies = PIVOT_CHART_FONT_FAMILIES.map((f) => ( )) const fontSizes = PIVOT_CHART_FONT_SIZES.map((f) => ( )) return ( <>

{title}

目标值 前缀 后缀 半径 分隔段数 起始角度 结束角度 顺时针

标题

显示标题 距离左侧 距离顶部

数据

显示数据 距离左侧 距离顶部

指针

显示指针 自定颜色 { customPointerColor && ( ) } 长度 粗细 边框

粗细 颜色 显示刻度 显示标签 距离轴线

分隔线

显示分隔线
) } } export default GaugeSection