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

Full screen action #132

Open
domoritz opened this issue Mar 1, 2019 · 6 comments
Open

Full screen action #132

domoritz opened this issue Mar 1, 2019 · 6 comments

Comments

@domoritz
Copy link
Member

domoritz commented Mar 1, 2019

It would be great to have an action to open a chart in full screen.

@jmaFinistereVar
Copy link

I tried to develop this functionality for a project but I am not sure I chose the right solution. I first tried with addSignalListener but after couple of hours searching for examples did not succeed (I always receive an Unrecognized signal name error message). I then opted for an addEventListener and now my figure re-sizes when I double click on it.

  • Here is my html file
    <div #dsHist id="distanceHistogram"></div>

  • and the corresponding Angular code

ngAfterViewInit()   
{  
        let el: string = "#distanceHistogram";  
        let data: Array<{ distance_km: number }> = [];  
        for (let i = 0; i < 10000; i++) {  
            data.push({ distance_km: Math.floor(Math.random() * 100) });  
        }
       embed.default(el, {
            data: { values: data },
            mark: "bar",
            encoding: {
                x: {
                    field: "distance_km",
                    type: "quantitative",
                    title: "Distance (km)"
                },
                y: {
                    aggregate: "count",
                    type: "quantitative"
                }
            }
        })
            .then((res: embed.Result) => {    
                let view: vega.View = res.view;
                view.width(FullScreenTry02Component.WIDTH_PX);
                view.height(FullScreenTry02Component.HEIGHT_PX);

                view.addEventListener("dblclick", function (name, value) {
                    this._fullScreen = !this._fullScreen;
                    if (this._fullScreen) {
                        view.width(FullScreenTry02Component.WIDTH_PX_FULL_SCREEN);
                        view.height(FullScreenTry02Component.HEIGHT_PX_FULL_SCREEN);
                    }
                    else {
                        view.width(FullScreenTry02Component.WIDTH_PX);
                        view.height(FullScreenTry02Component.HEIGHT_PX);
                    }
                })
                return res.view.runAsync();
            })
            .then(v => {
                let view: vega.View = v;
            })
            .catch(function (err) {
                throw new Error(err);
            })
}

Now the figure re-sizes correctly when I double-click but I am not sure at all the solution I propose is correct.
What's more I still do not know how to add a full screen icon as displayed in the figure below (peraphs should I use layers) ?

image

Any feedback will be greatly appreciated !

@domoritz
Copy link
Member Author

My idea was to add another action to the Vega-Embed actions, which is independent of Vega signals. See

// add 'Export' action

@domoritz
Copy link
Member Author

domoritz commented May 9, 2020

Closing since noone has asked for this yet.

@domoritz domoritz closed this as completed May 9, 2020
@metasoarous
Copy link
Contributor

Doh; Apparently I missed the boat on this! I think this is a great idea, and would definitely use it! Please consider reopening.

Thanks!

@domoritz
Copy link
Member Author

domoritz commented Oct 4, 2021

Wanna send a pull request? I'm happy to help with reviews.

@metasoarous
Copy link
Contributor

Maybe; LOL. It's not high priority for me right now, but I might consider working on it at some point.

How do you feel about reopening so that folks interested in contributing can find it more easily?

Thanks as always

@domoritz domoritz reopened this Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants