Skip to content

Commit

Permalink
Merge pull request #1037 from bjarthur/bja/interactivity
Browse files Browse the repository at this point in the history
enhanced interactivity
  • Loading branch information
bjarthur authored Mar 16, 2018
2 parents 7abefe8 + 9567cf3 commit 0db3756
Show file tree
Hide file tree
Showing 15 changed files with 446 additions and 459 deletions.
9 changes: 9 additions & 0 deletions docs/src/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,12 @@ the sort produced by d3, this sort of mild interactivity can improve a lot of
standard plots. The fuel efficiency plot is made more clear by toggling off some
of the countries, for example. To do so, simply click or shift-click in the
colored squares in the table of keys to the right.

One can also zoom in and out by pressing the shift key while either scrolling
the mouse wheel or clicking and dragging a box. Should your mouse not work,
try the plus, minus, I, and O, keys. Panning is similarly easy: click and drag
without depressing the shift key, or use the arrow keys. For Vim enthusiasts,
the H, J, K, and L keys pan as expected. To reset the plot to it's initial
state, double click it or hit R.

Lastly, press C to toggle on and off a numerical display of the cursor coordinates.
23 changes: 7 additions & 16 deletions src/Gadfly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -616,21 +616,12 @@ function render_prepare(plot::Plot)
end

if !facet_plot
if !in(Guide.PanelBackground, explicit_guide_types)
push!(guides, Guide.background())
end

if !in(Guide.ZoomSlider, explicit_guide_types)
push!(guides, Guide.zoomslider())
end

if !in(Guide.XTicks, explicit_guide_types)
push!(guides, Guide.xticks())
end

if !in(Guide.YTicks, explicit_guide_types)
push!(guides, Guide.yticks())
end
in(Guide.PanelBackground, explicit_guide_types) || push!(guides, Guide.background())
in(Guide.QuestionMark, explicit_guide_types) || push!(guides, Guide.questionmark())
in(Guide.HelpScreen, explicit_guide_types) || push!(guides, Guide.helpscreen())
in(Guide.CrossHair, explicit_guide_types) || push!(guides, Guide.crosshair())
in(Guide.XTicks, explicit_guide_types) || push!(guides, Guide.xticks())
in(Guide.YTicks, explicit_guide_types) || push!(guides, Guide.yticks())
end

for guide in guides
Expand Down Expand Up @@ -1084,7 +1075,7 @@ function display(d::REPLDisplay, ::MIME"text/html", p::Union{Plot,Compose.Contex
<title>Gadfly Plot</title>
<meta charset="utf-8">
</head>
<body>
<body style="margin:0">
<script charset="utf-8">
$(readstring(Compose.snapsvgjs))
</script>
Expand Down
Loading

0 comments on commit 0db3756

Please sign in to comment.