[racket-users] Re: Adding interactive overlays to racket plots

2018-02-09 Thread Evan Whitmer
Looks awesome!

On Friday, February 9, 2018 at 4:27:46 PM UTC-10, Alex Harsanyi wrote:
>
>
>
> On Saturday, February 10, 2018 at 10:00:29 AM UTC+8, Evan Whitmer wrote:
>>
>> Do you anticipate this playing well with charts that have multiple Y 
>> values for a given X value. For example, candlestick plotting 
>> 
>>  
>> has recently landed in racket/plot. It would be great to be able to show 
>> all of the values, or at least specify which of the open/high/low/close 
>> values to display.
>>
>> Evan
>>
>>
> Yes.  The way this is implemented is that you will need to add a callback 
> to the returned plot and from the callback add as many overlays as you 
> want, where you want them (not necessarily at the X location). The 
> advantage of this method is that you can display any value you want on the 
> overlay, not just simply the value of the plotted function at the current 
> location.  The disadvantage is that the feature is not 'free", like the 
> zoom-unzoom functionality: the user has to add the callback and provide the 
> overlays.
>
> In my case, most of the interesting use cases do not involve simply 
> showing the value of a function at the current location.  I put some 
> examples here: 
> https://alex-hhh.github.io/2018/02/interactive-overlays-with-the-racket-plot-package.html
>
> I have not looked at candlestick plots, however, I imagine that you can 
> work out what the current value is from the X position and show the 
> open/low/high/close values either as a single badge or as markers on the 
> relevant positions of the candlestick.
>
> Best Regards,
> Alex.
>
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Adding interactive overlays to racket plots

2018-02-09 Thread Alex Harsanyi


On Saturday, February 10, 2018 at 10:00:29 AM UTC+8, Evan Whitmer wrote:
>
> Do you anticipate this playing well with charts that have multiple Y 
> values for a given X value. For example, candlestick plotting 
> 
>  
> has recently landed in racket/plot. It would be great to be able to show 
> all of the values, or at least specify which of the open/high/low/close 
> values to display.
>
> Evan
>
>
Yes.  The way this is implemented is that you will need to add a callback 
to the returned plot and from the callback add as many overlays as you 
want, where you want them (not necessarily at the X location). The 
advantage of this method is that you can display any value you want on the 
overlay, not just simply the value of the plotted function at the current 
location.  The disadvantage is that the feature is not 'free", like the 
zoom-unzoom functionality: the user has to add the callback and provide the 
overlays.

In my case, most of the interesting use cases do not involve simply showing 
the value of a function at the current location.  I put some examples here: 
https://alex-hhh.github.io/2018/02/interactive-overlays-with-the-racket-plot-package.html

I have not looked at candlestick plots, however, I imagine that you can 
work out what the current value is from the X position and show the 
open/low/high/close values either as a single badge or as markers on the 
relevant positions of the candlestick.

Best Regards,
Alex.


 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Adding interactive overlays to racket plots

2018-02-09 Thread Evan Whitmer
Do you anticipate this playing well with charts that have multiple Y values 
for a given X value. For example, candlestick plotting 

 
has recently landed in racket/plot. It would be great to be able to show 
all of the values, or at least specify which of the open/high/low/close 
values to display.

Evan

On Monday, January 29, 2018 at 1:09:42 AM UTC-10, Alex Harsanyi wrote:
>
> The racket plot package produces interactive snip% objects which allow 
> zooming of the plot area. While this is a cool and sometimes useful 
> feature, the functionality is hard coded in the plot-snip% class inside the 
> package. I would like to extend the package to allow the user to customize 
> the interactive features of the plot -- most of the graphing packages for 
> the web support the display of additional information when the user hovers 
> the mouse over the plot.
>
> I have built a prototype implementation of adding interactive overlays to 
> plot snips, as shown in the image below, and I would like to ask if there 
> is interest in adding such a feature to the plot package distributed with 
> racket.
>
> At this point, the code is at a "proof of concept" stage, but ultimately, 
> I will add interactive features to the plots in my application and they 
> will be more complex than just showing the value of a function at a cursor 
> location. As part of that experience, I will better understand what actual 
> features I need, and hope to refine this interface. I am also looking for 
> feedback, in particular if this would be the right approach for doing this.
>
> The prototype implementation is here: 
> https://github.com/alex-hhh/plot/tree/ah/interactive-overlays
>
> The code to generate the plot below is here: 
> https://gist.github.com/alex-hhh/64f8af9c4bd5b5c65ada62dd9157e938 
>
> As it is implemented now, unless a "hover callback" is added to the plot 
> snip, the snip behaves as before, allowing zoom and unzoom when the mouse 
> is dragged over the plot area.
>
>
>
>
> 
>
>
> 
> Best Regards,
> Alex.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.