首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Webdatarocks web枢轴表中hh:mm:ss中的Excel导出

Webdatarocks web枢轴表中hh:mm:ss中的Excel导出
EN

Stack Overflow用户
提问于 2022-02-08 11:00:33
回答 1查看 66关注 0票数 0

如果在webdatarocks中将数据配置为时间,则在Excel中正确地以hh:mm:ss格式导出数据。但是,如果我们有一个计算值,它是通过将时间值除以数值(得到平均值)得到的,并且这个计算值被定义为时间,那么在web中,它以正确的格式显示,但以导出的秒表示。下面是来自webdatarocks代码页的示例,我在这里增加了AVG的新价值。它在web上显示为00:20:00,但在excel中导出为1200。

代码语言:javascript
复制
        "Duration": {
            type: "time"
        },
        "Movie Name": {
            type: "string"
        },
  "AVG": {
            type: "time"
        },
        "Rating": {
            type: "number"
        },
        "Genre": {
            type: "string"
        }
    },
    {
        "Movie Name": "Star Wars: The Last Jedi",
        "Rating": 7.2,
        "Genre": "Fantasy",
        "Duration": 9120
    },
    {
        "Movie Name": "Blade Runner 2049",
        "Rating": 7.2,
        "Genre": "Sci-Fi",
        "Duration": 9840
    },
    {
        "Movie Name": "Harry Potter and the Sorcerer's Stone",
        "Rating": 7.6,
        "Genre": "Adventure",
        "Duration": 9120
    },
    {
        "Movie Name": "Incredibles 2",
        "Rating": 8.1,
        "Genre": "Animation",
        "Duration": 7080
    },
    {
        "Movie Name": "Ratatouille",
        "Rating": 8.0,
        "Genre": "Comedy",
        "Duration": 6660
    },
    {
        "Movie Name": "Scott Pilgrim vs. the World",
        "Rating": 7.5,
        "Genre": "Romance",
        "Duration": 6720
    }
];
var pivot = new WebDataRocks({
    container: "wdr-component",
    toolbar: true,
    report: {
        dataSource: {
            data: JSONData
        },
    "slice": {
          "rows": [
              {
                  "uniqueName": "Movie Name"
              }
          ],
          "columns": [
              {
                  "uniqueName": "Genre"
              },
              {
                  "uniqueName": "Duration"
              },
              {
                  "uniqueName": "Measures"
              }
          ],
          "measures": [
              {
                  "uniqueName": "Rating",
                  "aggregation": "sum"
              },
            {
                "uniqueName": "AVG",
                "formula": "sum(\"Duration\") / sum(\"Rating\")",
                "caption": "Avg"
            },
          ],
          "expands": {
              "columns": [
                  {
                      "tuple": [
                          "Genre.Adventure"
                      ]
                  },
                  {
                      "tuple": [
                          "Genre.Animation"
                      ]
                  },
                  {
                      "tuple": [
                          "Genre.Comedy"
                      ]
                  },
                  {
                      "tuple": [
                          "Genre.Fantasy"
                      ]
                  }
              ]
          }
      }
    }
});
EN

回答 1

Stack Overflow用户

发布于 2022-02-10 15:52:54

目前,WebDataRocks没有提供设置导出计算度量值的时间格式的选项。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71032745

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档