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

Embed plot into GUI application #126

Open
Psirus opened this issue Jul 8, 2021 · 4 comments
Open

Embed plot into GUI application #126

Psirus opened this issue Jul 8, 2021 · 4 comments

Comments

@Psirus
Copy link

Psirus commented Jul 8, 2021

I've just stumbled upon Gintro, and noticed that they have multiple examples of drawing in the resulting window using Cairo; see here, here and here. Since ggplotnim uses Cairo as a backend, would it be possible to plot directly in a GUI window?

@Vindaar
Copy link
Owner

Vindaar commented Jul 8, 2021

Hey!

Thanks for the interest!

Indeed, this should be quite possible. I haven't started any work on it, as I personally didn't have a need for it so far. Simply drawing on a GTK window seems easy enough. The problem is typically people expect things to be interactive at that point too. While that is probably not super difficult to implement it, well, needs to be done.

Is this something you need for a project or are you just curious? If it's the former I can look into it sooner rather than later.

@Psirus
Copy link
Author

Psirus commented Jul 8, 2021

I recently have found renewed motivation for an old project of mine (https://github.com/Psirus/altai), which is written in Python. And since I now generally prefer Nim, I briefly thought about a rewrite. And in my case, I wouldn't need interactivity.

So I'm curious, and I would like to use it in a project, but its neither important nor urgent.

@Vindaar
Copy link
Owner

Vindaar commented Jul 8, 2021

Ah, cool!

If you just need something static, I'll see if I can get something working.

@Vindaar
Copy link
Owner

Vindaar commented Sep 12, 2023

Took a while, but with #169 we now have at least a very basic, interactive backend to view plots and zoom. Improvements should be (mostly) simple to make it nicer. The same approach can of course be used for libraries other than SDL2. And it provides a reference about how one can include a ggplotnim plot into a GUI application of their own.

Standalone example here:
https://gist.github.com/Vindaar/97296bcc5ec12f1630187c1db1de11ea

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

2 participants