Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add annotation API #198

Open
tiby312 opened this issue Nov 30, 2022 · 1 comment
Open

Add annotation API #198

tiby312 opened this issue Nov 30, 2022 · 1 comment

Comments

@tiby312
Copy link
Owner

tiby312 commented Nov 30, 2022

Something like this:

use poloto::build;
// PIPE me to a file!
fn main() {
    let data = vec![[0, 0], [1, 2], [2, 3]];

    let a = build::plot("label").line(data);

    poloto::data(a)
        .build_and_label(("hello world", "x", "y"))
        .annotate(|w|{
            let point=w.convert_point([1,2]);
            
            let circle=hypermelon::build::elem("circle").with(attrs!(("x",point.x),("y",point.y)))

            let text_pos=w.request_text_position();

            let text=hypermelon::build::elem("text").with(attrs!(("x",text_pos.x),("y",text_pos.y)))

            circle.append(text)
        })
        .append_to(poloto::header().light_theme())
        .render_stdout();
}
@tiby312
Copy link
Owner Author

tiby312 commented Jan 20, 2023

Or at-least just provide a projection matrix that you can feed data points, and have the point in the svg canvas space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant