Skip to content
Discussion options

You must be logged in to vote

I'm not sure I understand the final desired format, but would something like this be what you want (the "volume" showing in the parenthesis):

import altair as alt
from altair.datasets import data

source = data.stocks()

# Simulate some volume data
source = source.assign(volume=1000 * source["price"])

base = alt.Chart(source).encode(x="date:T")

columns = sorted(source.symbol.unique())

selection = alt.selection_point(
    fields=["date"],
    nearest=True,
    on="pointerover",
    empty=False,
    clear="pointerout",
)

lines = base.mark_line().encode(
    y="price:Q",
    color="symbol:N",
)

points = lines.mark_point().transform_filter(selection)

rule = (
    base
    .transform_cal…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@philipdeboer
Comment options

Answer selected by philipdeboer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants