最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

powerbi - Modifying Deneb Gantt chart to include Hours - Stack Overflow

programmeradmin3浏览0评论

All I am attempting to do is add "Hours" and have it show ticks by hour of the day on the timeline (With Date and Month on the upper row). I have added Hours but for some reason it selects both Hours and Days and any changes to timeline affects both. It won't let me put the entire code in due to character limit so I am only including portion that I think is where changes are needed. (While this is a vega json script I am using for Deneb in PowerBI, it only renders in PowerBI but not on Vega editor).

  "axes": [
    {
      "description": "Bottom date axis",
      "ticks": true,
      "labelPadding": -12,
      "scale": "x",
      "position": {
        "signal": "columnsWidth"
      },
      "orient": "top",
      "tickSize": 15,
      "grid": false,
      "zindex": 1,
      "labelOverlap": false,
      "formatType": "time",
      "tickCount": {
        "signal": "dayBandwidthRound>=minYearBandwidth?'day':'month'"
      },
      "encode": {
        "ticks": {
          "update": {
            "strokeWidth": [
              {
                "test": "hourBandwidthRound>=minHourBandwidth",
                "value": 1
              },
              {
                "test": "dayBandwidthRound>=minDayBandwidth",
                "value": 1
              },              
              {
                "test": "dayBandwidthRound>=minMonthBandwidth && dayBandwidthRound<minDayBandwidth && date(datum.value) == 1",
                "value": 1
              },
              {
                "test": "dayBandwidthRound>=minYearBandwidth && dayBandwidthRound<minMonthBandwidth && date(datum.value) == 1",
                "value": 1
              },
              {
                "test": "dayBandwidthRound<minYearBandwidth && dayofyear(datum.value) == 1",
                "value": 1
              },
              {
                "value": 0
              }
            ]
          }
        },
        "labels": {
          "update": {
            "text": [
              {
                "test": "hourBandwidthRound>=minHourBandwidth",
                "signal": "timeFormat(datum.value,'%d')" // todo: '%H:%M' returns 00 for all Hours and Days
              },                        
              {
                "test": "dayBandwidthRound>=minDayBandwidth",
                "signal": "timeFormat(datum.value,'%d')"
              },              
              {
                "test": "dayBandwidthRound>=minMonthBandwidth && dayBandwidthRound<minDayBandwidth && date(datum.value) == 15",
                "signal": "timeFormat(datum.value,'%B %y')"
              },
              {
                "test": "dayBandwidthRound>=minYearBandwidth && dayBandwidthRound<minMonthBandwidth && date(datum.value) == 15",
                "signal": "timeFormat(datum.value,'%b')"
              },
              {
                "test": "dayBandwidthRound<minYearBandwidth && month(datum.value) == 6",
                "signal": "timeFormat(datum.value,'%Y')"
              },
              {
                "value": ""
              }
            ],
            "dx": {
              "signal": "dayBandwidthRound/2"
            }
          }
        }
      }
    },
    {
      "description": "Top date axis",
      "scale": "x",
      "position": {
        "signal": "columnsWidth"
      },
      "domain": false,
      "orient": "top",
      "offset": 0,
      "tickSize": 22,
      "labelBaseline": "middle",
      "grid": false,
      "zindex": 0,
      "tickCount": {
        "signal": "dayBandwidthRound>=minYearBandwidth?'day':'month'"
      },
      "encode": {
        "ticks": {
          "update": {
            "strokeWidth": [
              {
                "test": "dayBandwidthRound>=minDayBandwidth && date(datum.value) == 1",
                "value": 1
              },
              {
                "test": "dayBandwidthRound>=minYearBandwidth && dayBandwidthRound<minDayBandwidth && dayofyear(datum.value) == 1",
                "value": 1
              },
              {
                "value": 0
              }
            ]
          }
        },
        "labels": {
          "update": {
            "text": [
              {
                "test": "dayBandwidthRound>=minDayBandwidth && date(datum.value) == 15",
                "signal": "timeFormat(datum.value,'%B %y')"
              },
              {
                "test": "dayBandwidthRound>=minYearBandwidth && dayBandwidthRound<minMonthBandwidth && month(datum.value) == 5 && date(datum.value) == 15",
                "signal": "timeFormat(datum.value,'%Y')"
              },
              {
                "value": ""
              }
            ],
            "dx": {
              "signal": "dayBandwidthRound/2"
            }
          }
        }
      }
    }
发布评论

评论列表(0)

  1. 暂无评论