唯杰地图 logo唯杰地图
VJMAP
EN

minimal-bar.vp.tsx

vjvp/examples/minimal-bar.vp.tsx 2.7 KB114 行
原文
/** @jsx h */
// AUTO-GENERATED by export-examples-tsx —— 由同名 .vpproj.json 导出的 VP-TSX 配对视图(已回编译等值验证)。
// 修改请改 JSON 后重跑导出脚本,或改本文件后用 compile.mts 重编 JSON——保持两者一致。
import { defineProject, h } from '../scripts/vptsx/runtime'

export default defineProject({
  name: "最小柱状图示例",
  connections: [
    {
      "uid": "conn_sales",
      "name": "销售数据",
      "type": "json",
      "connectorType": "json",
      "config": {
        "copyToRoot": true,
        "fileName": ""
      },
      "tables": [
        {
          "uid": "tbl_sales",
          "name": "销售数据",
          "fields": [
            {
              "uid": "月份",
              "alias": "月份",
              "type": "string"
            },
            {
              "uid": "销售额",
              "alias": "销售额",
              "type": "number"
            }
          ]
        }
      ]
    }
  ],
  connectionData: {
    "conn_sales": [
      {
        "tableId": "tbl_sales",
        "tableName": "销售数据",
        "fields": [
          {
            "uid": "月份",
            "alias": "月份",
            "type": "string"
          },
          {
            "uid": "销售额",
            "alias": "销售额",
            "type": "number"
          }
        ],
        "rows": [
          {
            "月份": "一月",
            "销售额": 120
          },
          {
            "月份": "二月",
            "销售额": 200
          },
          {
            "月份": "三月",
            "销售额": 150
          },
          {
            "月份": "四月",
            "销售额": 80
          },
          {
            "月份": "五月",
            "销售额": 170
          },
          {
            "月份": "六月",
            "销售额": 110
          }
        ]
      }
    ]
  },
  screen: (
    <screen
      uid={"screen_main"}
      name={"主页面"}
      fullscreen-mode={"fill-uniform"} fill-auto-expand={true}
      size={[1920,1080]}
      background-color={"#0c0d0e"}
      stateOverrides={{}}
    >
      <basic-text
        uid={"w_title"}
        position={[120,80]}
        size={[600,60]}
        text={"月度销售额"}
        text-font={{"size":32,"color":"#ffffff"}}
        stateOverrides={{}}
      />
      <chart-bar
        uid={"w_bar"}
        position={[120,180]}
        size={[640,360]}
        title={"销售额"}
        show-label={true}
        category-field={[["conn_sales","tbl_sales","月份"]]}
        metric-fields={[["conn_sales","tbl_sales","销售额"]]}
        stateOverrides={{}}
      />
    </screen>
  ),
})