Commit 444b2467 authored by XieZhiXiong's avatar XieZhiXiong

feat: 添加 strokeWidth 线条宽度属性

parent 600d7b44
...@@ -20,6 +20,10 @@ export interface GaugeProps { ...@@ -20,6 +20,10 @@ export interface GaugeProps {
formatter?: (value: string) => string; formatter?: (value: string) => string;
// 格式化内容 // 格式化内容
formatContent?: (value: number) => string; formatContent?: (value: number) => string;
/**
* 线条宽度
*/
strokeWidth?: number,
} }
const defaultFormatter = (val: string): string => { const defaultFormatter = (val: string): string => {
...@@ -85,6 +89,7 @@ const Gauge: React.FC<GaugeProps> = (props) => { ...@@ -85,6 +89,7 @@ const Gauge: React.FC<GaugeProps> = (props) => {
formatContent = defaultFormatContent, formatContent = defaultFormatContent,
color = '#2F9CFF', color = '#2F9CFF',
bgColor = '#F0F2F5', bgColor = '#F0F2F5',
strokeWidth = 10,
} = props; } = props;
const cols = { const cols = {
value: { value: {
...@@ -128,12 +133,10 @@ const Gauge: React.FC<GaugeProps> = (props) => { ...@@ -128,12 +133,10 @@ const Gauge: React.FC<GaugeProps> = (props) => {
label={{ label={{
offset: -24, offset: -24,
formatter, formatter,
textStyle, style: textStyle,
}} }}
subTickLine={null} subTickLine={null}
tickLine={{ tickLine={null}
length: -12,
}}
grid={null} grid={null}
/> />
<Point <Point
...@@ -148,7 +151,7 @@ const Gauge: React.FC<GaugeProps> = (props) => { ...@@ -148,7 +151,7 @@ const Gauge: React.FC<GaugeProps> = (props) => {
end={[10, 0.965]} end={[10, 0.965]}
style={{ style={{
stroke: bgColor, stroke: bgColor,
lineWidth: 10, lineWidth: strokeWidth,
lineDash: null, lineDash: null,
}} }}
/> />
...@@ -157,7 +160,7 @@ const Gauge: React.FC<GaugeProps> = (props) => { ...@@ -157,7 +160,7 @@ const Gauge: React.FC<GaugeProps> = (props) => {
end={[data[0].value, 0.965]} end={[data[0].value, 0.965]}
style={{ style={{
stroke: color, stroke: color,
lineWidth: 10, lineWidth: strokeWidth,
lineDash: null, lineDash: null,
}} }}
/> />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment