Implement a Value Cursor on a Chart
Added by Michael De Paola almost 10 years ago
Hi All,
I was just wondering if there was a way to implement a cursor to read values from a chart.
For an example of what I mean see the screenshot here: http://www.howtocvi.net/2011/03/how-to-add-graph-cursor.html
I was thinking about doing a mouse over area of a pixel size but I wanted to know if someone had a better way to do this.
Thanks,
Michael
Replies (3)
RE: Implement a Value Cursor on a Chart - Added by Koen Deforche almost 10 years ago
Hey,
This has recently been added as a feature to WCartesianChart (available only in the git version of Wt):
- WCartesianChart::setCrosshairEnabled(true)
- WCartesianChart::setFollowCurve(column)
Koen
RE: Implement a Value Cursor on a Chart - Added by Michael De Paola almost 10 years ago
Thanks Koen,
After trying this out, I wanted to know if there's a way to have the crosshair be moved using click and drag (or just a method that will cause the cursor to stay up, but stop following the cursor and instead stay in its current position) instead of it always following the cursor so that I can place the crosshair at a point to "mark" it. That way I could then use the cursor to maybe mark another point so I can show information like the difference between the two x (or y) values of the two different marked points.
Alternatively if I can have two crosshairs enabled on the same (or even different) curve at once to do something like this that would be a good shortcut to what I need.
In the header file it says I can do something like the first situation I described "when using touch", but does that only apply to touch screen devices accessing the page, or is it also an option to enable somewhere when viewing from a standard browser?
Thanks,
Michael
RE: Implement a Value Cursor on a Chart - Added by Michael De Paola almost 10 years ago
Also after playing with the crosshair functionality for a while I realized I don't see a function to disable it that I could use to make the crosshair toggleable. Does one not exist or am I just not very good at finding things?
Thanks,
Michael