Bläddra i källkod

adding default value for showValue

namnguyen 1 år sedan
förälder
incheckning
ccc9443738

+ 3 - 2
frontend/taipy-gui/src/components/Taipy/Metric.tsx

@@ -58,7 +58,8 @@ const defaultStyle = {position: "relative", display: "inline-block"};
 const Metric = (props: MetricProps) => {
     const {
         width = "100%",
-        height
+        height,
+        showValue = true
     } = props;
     const value = useDynamicProperty(props.value, props.defaultValue, 0)
     const threshold = useDynamicProperty(props.threshold, props.defaultThreshold, undefined)
@@ -72,7 +73,7 @@ const Metric = (props: MetricProps) => {
             domain: {x: [0, 1], y: [0, 1]},
             value: value,
             type: "indicator",
-            mode: "gauge" + (props.showValue ? "+number" : "")  + (delta !== undefined ? "+delta" : ""),
+            mode: "gauge" + (showValue ? "+number" : "")  + (delta !== undefined ? "+delta" : ""),
             delta: {
                 reference: typeof value === 'number' && typeof delta === 'number' ? value - delta : undefined,
             },

+ 1 - 1
taipy/gui/_renderers/factory.py

@@ -364,13 +364,13 @@ class _Factory:
                 ("layout", PropertyType.dynamic_dict),
                 ("style", PropertyType.dynamic_dict),
                 ("type", PropertyType.string, "circular"),
-                ("show_value", PropertyType.boolean, True),
                 ("min", PropertyType.number, 0),
                 ("max", PropertyType.number, 100),
                 ("delta", PropertyType.dynamic_number),
                 ("threshold", PropertyType.dynamic_number),
                 ("width", PropertyType.string_or_number),
                 ("height", PropertyType.string_or_number),
+                ("show_value", PropertyType.boolean, True),
             ]
         ),
         "navbar": lambda gui, control_type, attrs: _Builder(