vega-lite - 鼠标悬停时如何仅在特定轴上缩放?
解决方案
如果您希望在每个面板中滚动是独立的,您需要做两件事:
- set
resolve.scale.x
和resolve.scale.y
to"independent"
,所以刻度不会被链接。 - 在每个面板中为绑定选择使用不同的名称,因此选择器不会被链接。
例如(维加编辑器):
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {"url": "data/stocks.csv"},
"vconcat": [
{
"transform": [{"filter": "datum.symbol==='IBM'"}],
"mark": "line",
"encoding": {
"x": {"field": "date", "type": "temporal"},
"y": {"field": "price", "type": "quantitative"}
},
"selection": {"scroll_1": {"type": "interval", "bind": "scales"}}
},
{
"transform": [{"filter": "datum.symbol==='GOOG'"}],
"mark": "line",
"encoding": {
"x": {"field": "date", "type": "temporal"},
"y": {"field": "price", "type": "quantitative"}
},
"selection": {"scroll_2": {"type": "interval", "bind": "scales"}}
}
],
"resolve": {"scale": {"x": "independent", "y": "independent"}}
}
推荐阅读
- java - RecyclerView 中的行“折叠”
- sql - 如何通过在 Postgresql 的特定位置附加一些文本来更新电子邮件列
- powershell - powershell就地删除文本文件中的双引号,其中行以双引号+一些其他文本开头
- python - 使用 Python 构建自定义 RandomSearchCV
- c++ - 如何正确实现具有原始指针的类的复制构造函数?
- c# - 处理从外部应用程序打开的文件以加载 WPF 应用程序?
- c# - EF Core 2.1 检查表中是否存在一对属性
- python - python;变量的地址,整数值是不可变的?
- c++ - 我想在 C++ 中使用 for 循环创建类对象
- prisma-graphql - 使用 Nexus 在多对多字段上创建 Prisma 2 Mutation