1. Finding value on a chart - attn. Derek
- Posted by doncole2009 Jul 08, 2009
- 940 views
Derek,
You gave me the formula to find Y.
TickRatio = ((MaxVal - MinVal) / (MaxY - MinY)) Y= floor(MaxY - (Value - MinVal)/TickRatio)
That works out fine. I use it all the time for my chart I am working on.
Thank you very much.
As I forgot a lot of my high school algebra I can't figure out:
Solve for Value given the the Y.
ie...
function getY(atom Value) TickRatio = ((MaxVal - MinVal) / (MaxY - MinY)) return floor(MaxY - (Value - MinVal)/TickRatio) end function
function getValue(integer Y) TickRatio = ((MaxVal - MinVal) / (MaxY - MinY)) return ?? end function
TIA Don Cole
2. Re: Finding value on a chart - attn. Derek
- Posted by DerekParnell (admin) Jul 08, 2009
- 930 views
Solve for Value given the the Y.
Try this ...
function getValue(integer Y) TickRatio = ((MaxVal - MinVal) / (MaxY - MinY)) return floor(MinVal - TickRatio * (Y - MaxY)) end function
3. Re: Finding value on a chart - attn. Derek
- Posted by doncole2009 Jul 09, 2009
- 899 views
Thank you Derek.
What I'm trying to do is draw cross hairs (moving with mouse) across graph or window. Without changing the graph or window.
If I ever finish I will upload a simplified version to the archives.
Don Cole
4. Re: Finding value on a chart - attn. Derek
- Posted by euphoric (admin) Jul 09, 2009
- 885 views
- Last edited Jul 10, 2009
What I'm trying to do is draw cross hairs (moving with mouse) across graph or window. Without changing the graph or window.
Don, if you're using Win32Lib, you can probably just change the cursor to cross hairs while it's over the graph. That way, you let the system draw it. You don't have to worry about plotting anything over your graph.
5. Re: Finding value on a chart - attn. Derek
- Posted by DerekParnell (admin) Jul 09, 2009
- 883 views
- Last edited Jul 10, 2009
What I'm trying to do is draw cross hairs (moving with mouse) across graph or window. Without changing the graph or window.
Don, if you're using Win32Lib, you can probably just change the cursor to cross hairs while it's over the graph. That way, you let the system draw it. You don't have to worry about plotting anything over your graph.
I think he means that the cross hairs extended from the top to bottom and left to right of the graph window but the intersection is where the mouse is.
6. Re: Finding value on a chart - attn. Derek
- Posted by doncole2009 Jul 09, 2009
- 872 views
- Last edited Jul 10, 2009
That's right on the right side of the graph are the prices
that will change color when the mouse rolls over them.
Perhaps a reverse of then original then it will return to normal
when the mouse leaves.
Don Cole
7. Re: Finding value on a chart - attn. Derek
- Posted by otterdad Jul 10, 2009
- 970 views
although I'm not entirely sure what your project is, i came across a wonderful piece of code years ago that generates it's own self scaling graphs based on any x,y type data sequence. the original thread is posted here.
hope it helps!