Opened 13 years ago
Closed 7 years ago
#8518 closed enhancement (patchwelcome)
Charting Events on Lines
Reported by: | ryangroth5 | Owned by: | Eugene Lazutkin |
---|---|---|---|
Priority: | high | Milestone: | 1.13 |
Component: | Charting | Version: | 1.2.3 |
Keywords: | charting lines events | Cc: | [email protected]… |
Blocked By: | Blocking: |
Description
Eugene,
I ran into a use-case where I am plotting several lines on a graph, where each has a different scale and thus a different plot. I wanted to extract the X/Y pairs from the line model and display them externally in a tooltip (similiar to google finance charts). I hooked up the event listener to my plots and no event fired except plot reset (this is 1.3pre).
I would like to propose the following quickie changes:
- Hook up event listeners to the plot lines.
- Provide some abstraction from the scalers within the plot2d object to transform between plot-relative x/y's and the model x/y's.
Here are what you have to decide:
- I don't know exactly what the event params should be for a relative line position. I understand that this position could be interpolated, which is not an issue for me.
- I made a couple assumptions in _connectEvents, I am not sure they are accurate.
- I added a modelXY2PlotXY and plotXY2ModelXY, you probably want to use dojo.coords or something like that. This is just for fun.
- I'm not sure all the performance implications. I was kinda surprised to see such a general connectEventToPlot without parameters for event type. Adding an event listener to a line doesn't seem to have such a big performance implication, but I don't know.
IN THE FUTURE...
- Consider chart-wide onMouseMove events, so that in the future you can hook up the legend and get google finance like X/Y's on all plots.
Thanks,
Ryan
Thanks for the consideration
Attachments (2)
Change History (8)
Changed 13 years ago by
Attachment: | charting.diff added |
---|
comment:1 Changed 13 years ago by
Oh. Did I mention that I attached a code sample and have a CLA on file.
comment:2 Changed 13 years ago by
Err...OK, so plotXY2ModelXY doesn't take into account the window function and/or the chart axis offsets. I think the way to fix this is to add in the appropriate window function offsets before plotEvent and make transform work with the size of the chart to translate correctly. Anyway, it would be great to be able to get out the original coordinates of a plot given an XY offset in the chart.
Thanks
Changed 13 years ago by
Attachment: | charting2.diff added |
---|
Update (disregard 1st diff) that fixes windowing issue, and fixes estimates on "XY" functions. Some remaining issues described below.
comment:3 Changed 13 years ago by
The only issue I have is a scroll-offset issue with the major browsers. As far as I understand the dojo.coords calls dojo.abs with the scroll-accountable flag set to true, which should give an absolute offset, but that is not happening somewhere down the line. I also don't understand the difference between cx, cy and x,y as far as lines are concerned.
comment:5 Changed 13 years ago by
Milestone: | 1.4 → future |
---|
comment:6 Changed 7 years ago by
Milestone: | future → 1.12 |
---|---|
Resolution: | → patchwelcome |
Status: | new → closed |
I have no idea why this never got attention 7 years ago. At this point, this is way out of date. If there's still this issue, and interest, I'm happy to work with you on a pull request. For now, I'm closing as patchwelcome.
Charting changes for line events.