vega lite散点图,每个数据点上都有超链接,不点击

k3bvogb1  于 2021-06-13  发布在  ElasticSearch
关注(0)|答案(0)|浏览(252)

我是按照这个文件制作的 href vega lite散点图编码内的通道。
我使用的数据来自elasticsearch索引。这是我的代码:

{
  $schema: https://vega.github.io/schema/vega-lite/v4.json
  data: {
    url: {
      %context%: true
      index: my_index
      body: {
        size: 10000
      }
    }
    format: {
      property: hits.hits
    }
  }
  transform: [
    {
      calculate: datum._source.price
      as: price
    }
    {
      calculate: datum._source.size
      as: size
    }
    {
      calculate: "'https://www.example.com/'+datum._source.id"
      as: url
    }
  ]
  layer: [
    {
      selection: {
        grid: {
          type: interval
          bind: scales
        }
      }
      mark: {
        type: circle
        tooltip: true
      }
      encoding: {
        x: {
          field: size
          type: quantitative
        }
        y: {
          field: price
          type: quantitative
        }
        href: {
          field: url
        }
      }
    }
  ]
}

代码可以工作,当鼠标悬停在分散点上时,鼠标会变为可识别的链接,但是单击本身不起作用。为什么?与文档化示例的唯一区别是数据来自 elasticsearch 我还有第二层情节。
如何使超链接工作?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题