bebu Posted July 31, 2007 Report Share Posted July 31, 2007 Hi, i want to paint a CustomCrosshair which Y-Value is always marking the appropiate Y Value of current X Value (the crosshait is always in the graph) i have this code in MouseMove : if (chart.Data.Compacted) { int point = (int)Math.Round(chart.AxisX.PixelToValue(e.X) * chart.Data.CompactedBy); if(point < 0) return; VertMarker.Value = chart.Data[0, point]; HorzMaker.Value = point; } else { int point = (int)Math.Round(chart.AxisX.PixelToValue(e.X)); if (point < 0) return; VertMarker.Value = chart.Data[0, point]; HorzMaker.Value = point; } I got 2 problems: If data is compacted, the crosshair of course isnt in par with graph, as i access the data array. So is there a way to get the actual displayed Y Value? The other problem is similar. Even when the data is not compacted, the cross isnt in place but hoovers smometimes beside the graph. Link to comment Share on other sites More sharing options...
bebu Posted August 1, 2007 Author Report Share Posted August 1, 2007 i found a solution for the problem: First chart.Compact() i just give in in rounded (in fact Ints) values. And second: HorzMarker.Value = point + 1; as the data array is 0 based while my setup seems to be 1 based. Link to comment Share on other sites More sharing options...
amankazi Posted May 7, 2008 Report Share Posted May 7, 2008 I have similar requirement. In your code you have declared VertMarker and HorzMaker. What is this object. Could you please share it with me? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.