소스 검색

add title for Metric.tsx

namnguyen 11 달 전
부모
커밋
8d7e50df21
3개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      frontend/taipy-gui/src/components/Taipy/Metric.tsx
  2. 1 0
      taipy/gui/_renderers/factory.py
  3. 5 0
      taipy/gui/viselements.json

+ 4 - 0
frontend/taipy-gui/src/components/Taipy/Metric.tsx

@@ -25,6 +25,7 @@ import { darkThemeTemplate } from "../../themes/darkThemeTemplate";
 const Plot = lazy(() => import("react-plotly.js"));
 
 interface MetricProps extends TaipyBaseProps, TaipyHoverProps {
+    title?: string
     type?: string
     min?: number
     max?: number
@@ -72,6 +73,9 @@ const Metric = (props: MetricProps) => {
         (delta !== undefined) && mode.push("delta");
         return [
             {
+                title: {
+                  text: props.title
+                },
                 domain: {x: [0, 1], y: [0, 1]},
                 value: value,
                 type: "indicator",

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

@@ -360,6 +360,7 @@ class _Factory:
         .set_attributes(
             [
                 ("id",),
+                ("title",),
                 ("active", PropertyType.dynamic_boolean, True),
                 ("layout", PropertyType.dynamic_dict),
                 ("type", PropertyType.string, "circular"),

+ 5 - 0
taipy/gui/viselements.json

@@ -1116,6 +1116,11 @@
                     "shared"
                 ],
                 "properties": [
+                    {
+                        "name": "title",
+                        "type": "str",
+                        "doc": "The title of the metric."
+                    },
                     {
                         "name": "value",
                         "default_property": true,