linkTemplate and/or onClick support for XYPlot track types #489

Closed
rdhayes opened this Issue Jun 20, 2014 · 10 comments

Comments

Projects
None yet
2 participants
@rdhayes
Contributor

rdhayes commented Jun 20, 2014

I need an ability to use either style.linkTemplate or onClick config options on histograms, so we can provide a link to the data source. This looks like a new feature request.

To match how this currently works for CanvasFeatures, it looks like this will entail:

  1. adding a call to this._setupEventHandlers() to the View/Track/WiggleBase.js constructor
  2. adding a copy of the _setupEventHandlers() function (from View/Track/_FeatureDetailMixin.js) somewhere in the Wiggle-related code. Perhaps just to WiggleBase.js itself.

I am missing anything else? This would apply the same URL to the entire histogram "feature", I think, which is fine for my purposes.

I'll try this on a dev copy and report how it goes.

@rdhayes rdhayes added the feature label Jun 20, 2014

@rdhayes rdhayes self-assigned this Jun 20, 2014

@rdhayes

This comment has been minimized.

Show comment
Hide comment
@rdhayes

rdhayes Jun 21, 2014

Contributor

I can see eventHandler.click get populated via either config option on the track object, but no event is registering. I think this has to do with the z-level and mouseover/mouseout events for the score "flag" display taking precedence. I'll try adding the onclick type handler to the score flag divs and see if that has any effect.

If that works, though, one side effect would be that I only get clickable pixles where there is histogram data to display. I might need to add another, higher z-level, div that is the size of the track canvas and add the click event handler there, perhaps.

Advice appreciated.

Contributor

rdhayes commented Jun 21, 2014

I can see eventHandler.click get populated via either config option on the track object, but no event is registering. I think this has to do with the z-level and mouseover/mouseout events for the score "flag" display taking precedence. I'll try adding the onclick type handler to the score flag divs and see if that has any effect.

If that works, though, one side effect would be that I only get clickable pixles where there is histogram data to display. I might need to add another, higher z-level, div that is the size of the track canvas and add the click event handler there, perhaps.

Advice appreciated.

@rdhayes

This comment has been minimized.

Show comment
Hide comment
@rdhayes

rdhayes Jun 24, 2014

Contributor

Some progress.

I had to add the mouse click event to the score display to be on the correct Z-level in the dom. This is working, for config using either style.linkTemplate or onClick to specify a URL. I also altered the new WiggleBase.js _setupEventHandlers() function to only call _makeClickHandler() if this.eventHandlers.click is true, allowing this to be a new feature and not complain about XYPlots without a linkout specified.

Neither style.linkTemplate nor onClick (must be functionally the same at some point in the code post-config-parsing?) for this track type are dropping in the standard variables for {ref}, {start}, {end}, etc. as I was hoping. Changing the URL specification to a callback function gives me the console error:

ReferenceError: Invalid left-hand side in assignment parsing config callback ''

I can probably tease out why that is happening, but any pointers to what is involved are appreciated.

Contributor

rdhayes commented Jun 24, 2014

Some progress.

I had to add the mouse click event to the score display to be on the correct Z-level in the dom. This is working, for config using either style.linkTemplate or onClick to specify a URL. I also altered the new WiggleBase.js _setupEventHandlers() function to only call _makeClickHandler() if this.eventHandlers.click is true, allowing this to be a new feature and not complain about XYPlots without a linkout specified.

Neither style.linkTemplate nor onClick (must be functionally the same at some point in the code post-config-parsing?) for this track type are dropping in the standard variables for {ref}, {start}, {end}, etc. as I was hoping. Changing the URL specification to a callback function gives me the console error:

ReferenceError: Invalid left-hand side in assignment parsing config callback ''

I can probably tease out why that is happening, but any pointers to what is involved are appreciated.

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin Jun 25, 2014

Contributor

The onClick variables are also mentioned here as not being populated by the {} notation. #480

Contributor

cmdcolin commented Jun 25, 2014

The onClick variables are also mentioned here as not being populated by the {} notation. #480

@rdhayes

This comment has been minimized.

Show comment
Hide comment
@rdhayes

rdhayes Jun 25, 2014

Contributor

This is similar, but I'm adding linkTemplate parameter to the XYPlot track type where this was not an option previously. When this is translated into the onClick spec (default action="newWindow", url set to linkTemplate) for use in BlockBased.js where the eventHandler and actual window() calls are made, the url config is typeof string, so the function callback is never evaluated. Having a hard time figuring out why that is or how to get it working.

Contributor

rdhayes commented Jun 25, 2014

This is similar, but I'm adding linkTemplate parameter to the XYPlot track type where this was not an option previously. When this is translated into the onClick spec (default action="newWindow", url set to linkTemplate) for use in BlockBased.js where the eventHandler and actual window() calls are made, the url config is typeof string, so the function callback is never evaluated. Having a hard time figuring out why that is or how to get it working.

@rdhayes

This comment has been minimized.

Show comment
Hide comment
@rdhayes

rdhayes Jun 25, 2014

Contributor

Okay, unlike attempts yesterday, the function is evaluating. I'll need to evaluate my git checkout to make sure I am still running with an unmodified BlockBased.js.

Like #480, I have to use this.track.browser.refSeq.name in place of track.browser.refSeq.name, but this is getting somewhere.

Where can I get the current view start and stop coordinates? That's not as obvious as refSeq name in the object tree. All I seem to find is variables like track.browser.locationBox.value (e.g. "scaffold_1:1117261..1128730") that would require string parsing.

Contributor

rdhayes commented Jun 25, 2014

Okay, unlike attempts yesterday, the function is evaluating. I'll need to evaluate my git checkout to make sure I am still running with an unmodified BlockBased.js.

Like #480, I have to use this.track.browser.refSeq.name in place of track.browser.refSeq.name, but this is getting somewhere.

Where can I get the current view start and stop coordinates? That's not as obvious as refSeq name in the object tree. All I seem to find is variables like track.browser.locationBox.value (e.g. "scaffold_1:1117261..1128730") that would require string parsing.

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin Jun 25, 2014

Contributor

Glad that helps! Anyways, as far as the view's start and stop coordinates, I think you could use "this.track.browser.view.visibleRegion()"

We had a post about using this function recently on the mailing list http://sourceforge.net/p/gmod/mailman/message/32492526/

Contributor

cmdcolin commented Jun 25, 2014

Glad that helps! Anyways, as far as the view's start and stop coordinates, I think you could use "this.track.browser.view.visibleRegion()"

We had a post about using this function recently on the mailing list http://sourceforge.net/p/gmod/mailman/message/32492526/

@rdhayes

This comment has been minimized.

Show comment
Hide comment
@rdhayes

rdhayes Jun 25, 2014

Contributor

Awesome, I knew it was something like that, but was completely escaping me.

I need to verify that there were no edits to BlockBased.js yesterday that magically enabled this today, and then it's a mere commit to WiggleBase.js to add this feature to the main branch.

Contributor

rdhayes commented Jun 25, 2014

Awesome, I knew it was something like that, but was completely escaping me.

I need to verify that there were no edits to BlockBased.js yesterday that magically enabled this today, and then it's a mere commit to WiggleBase.js to add this feature to the main branch.

@rdhayes

This comment has been minimized.

Show comment
Hide comment
@rdhayes

rdhayes Jun 25, 2014

Contributor

I'm a bit concerned that the error:

ReferenceError: Invalid left-hand side in assignment parsing config callback

is fleeting. Perhaps I had a stray control character in my config file that was preventing callback eval?

Contributor

rdhayes commented Jun 25, 2014

I'm a bit concerned that the error:

ReferenceError: Invalid left-hand side in assignment parsing config callback

is fleeting. Perhaps I had a stray control character in my config file that was preventing callback eval?

@rdhayes rdhayes closed this in af3ca54 Jun 25, 2014

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin Jun 25, 2014

Contributor

Great work. Would you mind changing tabs to spaces though?
Keeps it in style :)

Contributor

cmdcolin commented Jun 25, 2014

Great work. Would you mind changing tabs to spaces though?
Keeps it in style :)

@rdhayes

This comment has been minimized.

Show comment
Hide comment
@rdhayes

rdhayes Jun 25, 2014

Contributor

I blame emacs. Should be all set now.

Richard D. Hayes, Ph.D.
Joint Genome Institute / Lawrence Berkeley National Lab
http://phytozome.jgi.doe.gov

On Wed, Jun 25, 2014 at 3:09 PM, Colin notifications@github.com wrote:

Great work. Would you mind changing tabs to spaces though?
Keeps it in style :)


Reply to this email directly or view it on GitHub
#489 (comment).

Contributor

rdhayes commented Jun 25, 2014

I blame emacs. Should be all set now.

Richard D. Hayes, Ph.D.
Joint Genome Institute / Lawrence Berkeley National Lab
http://phytozome.jgi.doe.gov

On Wed, Jun 25, 2014 at 3:09 PM, Colin notifications@github.com wrote:

Great work. Would you mind changing tabs to spaces though?
Keeps it in style :)


Reply to this email directly or view it on GitHub
#489 (comment).

cmdcolin added a commit that referenced this issue Aug 1, 2014

Add example usage of XYPlot onClick, add examples of custom about pag…
…e and view details dialogs, and example of multiline callback for VCF. See #489 and #494 for reference
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment