Jump to content
Software FX Community

CustomCrosshair


bebu

Recommended Posts

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

 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

  • 9 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...