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

Is it possible to zoom on mobile ? #47

Open
yormi opened this issue Mar 31, 2018 · 4 comments
Open

Is it possible to zoom on mobile ? #47

yormi opened this issue Mar 31, 2018 · 4 comments

Comments

@yormi
Copy link

yormi commented Mar 31, 2018

Hi there !

I found this link of a vega example to zoom on pinch gesture but I'm not sure how I can translate into elm-vega.
Is it possible at all ?

Thanks

@jwoLondon
Copy link
Member

Hi Yormi, thanks for asking. I haven't tried it on a mobile, but does this work (creating a selection and binding it to the position scales, from. basic12 in the vlTestGallery)?

basic12 : Spec
basic12 =
    let
        enc =
            encoding
                << position X [ PName "income", PmType Quantitative, PScale [ SType ScLog ] ]
                << position Y [ PName "health", PmType Quantitative, PScale [ SZero False ] ]
                << size [ MName "population", MmType Quantitative ]
                << color [ MString "#000" ]

        sel =
            selection << select "view" Interval [ BindScales ]
    in
    toVegaLite
        [ width 500
        , height 300
        , dataFromUrl "https://vega.github.io/vega-lite/data/gapminder-health-income.csv" []
        , mark Circle []
        , enc []
        , sel []
        ]

@yormi
Copy link
Author

yormi commented Mar 31, 2018

Wow ! Such a quick reply, thanks !

Just tried it. Didn't work. I would have been surprised otherwise since it's pretty much the setting that I have right now. It works great on desktop but no luck on mobile.

It seems that the event hook "wheel" is not the same than the pinch gesture as it is in html. The way they handle the pinch-zoom in the example above seems way more complicated and uses signals (which are not available in vega-lite, right ?).

I tried to add the signals to the specs on the JS side but didn't manage to make it work either.

Any other ideas ?

@jwoLondon
Copy link
Member

It looks like we may be out of luck for the moment.

However, we will be resuming work on getting Vega integrated with the package, at which point we should have a solution. But this is likely to be a few weeks away I afraid.

@yormi
Copy link
Author

yormi commented Mar 31, 2018

Ah, well, I'll be patient. It's good to know that there is some work plan to integrate Vega.

I was seeing the task of making some kind of a dashboard page with graphs daunting. So far even with the limitations of the package (and vega-lite) it was surprisingly pleasant. The simplicity of the vega specs with the elm type system was totally worth the limitations.

I'll be patient for a solution for the mobile zoom.

Thank you again :)

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