2

Original Question

I'm using Microsoft Chart Control to display some data points as a Line. I have a Legend with custom items used to display calculated information about the line (mean average and others).

Now I've enabled IsUserSelectionEnabled which allows the user to "zoom into" a range of values and I want the legend items to be calculated on only the data points that are currently in view.

I can use the AxisViewChanged event to be notified of the view change, but what I can't figure out is how to enumerate only those DataPoint currently in view.

Update

The zoom isn't going to work for my purpose. What I discovered is that the NewPosition and NewSize properties of the AxisViewChanged event do in fact contain the precise area selected by the user, but the resulting zoom contains points outside of that area. I need more precision than that. What I need are two cursors, but the control only gives you one.

So my question now is: How do I customize this thing to add another cursor? I'm not asking just yet and if I do I'll start a new question.

Though I do still need to figure out how to translate client coords into data coords...

Updated again

I found the coord translation functions right on the Axis. Seems obvious in retrospect. ChartArea.Axis.PixelPositionToValue (for whichever axis you need) ChartArea.Axis.ValueToPixelPosition

Tergiver
  • 14,171
  • 3
  • 41
  • 68

0 Answers0