andredumas / techan.js

A visual, technical analysis and charting (Candlestick, OHLC, indicators) library built on D3.
http://techanjs.org/
MIT License
2.4k stars 535 forks source link

Could I obtain the price where my mouse is when click on the chart? #172

Open Kurdiez opened 8 years ago

Kurdiez commented 8 years ago

I am trying to build an interactive chart based trading app. I would love to place trades right on the chart. If I click my mouse on the chart, does techanjs allow me to obtain where the mouse was clicked in terms of the price?

andredumas commented 8 years ago

This is not techan specific, this can be done with d3 alone. If you place an overlay over the chart with appropriate mouse handlers it's quite straight forward to invert mouse coords to price. Crosshair does this to emit the move events (and will eventually emit click/mousedown events).