vega/altair

Explore and add examples for additional input elements

开放

#3,403 创建于 2024年4月13日

 (1 条评论) (2 个反应) (0 位负责人)Python (865 个派生)github user discovery
documentationgood first issue

仓库指标

星标
 (10,452 个星标)
PR 合并指标
 (平均合并 6天 9小时) (30 天内合并 4 个 PR)

描述

What is your suggestion?

There are many undocumented input options that work with Altair. It would be interesting to explore these more, e.g. maybe the date input could be useful to filter time series data which is not that easy with sliders currently. number also looks useful and maybe even file?

This example can be modified:

search_input = alt.selection_point(
    fields=['Name'],
    empty=False,  # Start with no points selected
    bind=alt.binding(
        input='date',  # Change this to any of the options at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types
        placeholder="Car model",
        name='Search ',
    )
)
alt.Chart(data.cars.url).mark_point(size=60).encode(
    x='Horsepower:Q',
    y='Miles_per_Gallon:Q',
    tooltip='Name:N',
    opacity=alt.condition(  # This condition would also need to be updated accordingly
        search_input,
        alt.value(1),
        alt.value(0.05)
    )
).add_params(
    search_input
)

image

Have you considered any alternative solutions?

No response

贡献者指南