有没有一种方法可以将汇总值传递给Vega Lite中简单直方图上的工具提示编码

时间:2019-08-26 16:58:31

标签: vega-lite

我想以简单的方式将计数的值添加到工具提示中,以添加到Vega Lite中的简单直方图吗?

类似这样的东西:

plugins {
    id 'org.springframework.boot' version '2.1.7.RELEASE' apply false
}

apply plugin: 'io.spring.dependency-management'
apply plugin: 'maven'

dependencyManagement {
    imports {
        mavenBom org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES
    }
}

repositories {
    mavenCentral()
}

jar {
    enabled = true
}

bootJar.dependsOn fooTask

似乎没有一种方法可以在工具提示编码中引用聚合的y编码。

1 个答案:

答案 0 :(得分:1)

工具提示就像其他任何编码一样;您可以将与y编码相同的参数传递给工具提示:

{
  "data": {
    "url": "data/movies.json"
  },
  "mark": "bar",
  "encoding": {
    "tooltip": [
      {
        "aggregate": "count",
        "type": "quantitative"
      }
    ],
    "x": {
      "bin": true,
      "field": "IMDB_Rating",
      "type": "quantitative"
    },
    "y": {
      "aggregate": "count",
      "type": "quantitative"
    }
  }
}

查看实际情况here