Click here to Skip to main content
15,882,315 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am plotting an MSChart from an observable collection. I am also having a datagrid whose itemsource is the same collection.
Now when I select a row/item in the datagrid, I want to display a label with the selcted x,y value near to the same point in my chart. I tried a lot but found no way. I can place label correctly only if i get screen coordinates of my selected data point. I have to fix this issue quickly.

Thanks
Nishitha
Posted
Comments
Member 8488836 1-May-12 20:34pm    
Hi Nishitha,
Can you please be more clear about your question?
Where are you putting your datagrids?
I have one possible solution, according to my understanding.
try this:
private void MSChart1_GetToolTipText(object sender, ToolTipEventArgs e)
{
DataPoint dP = MSChart1.Series["Series1"].Points[(int)MSChart1.ChartAreas["ChartArea1"].AxisX.PixelPositionToValue(e.X)];

e.Text = "SelectedDatapointLabel = "+ MSChart1.Series["Series1"].Points[dP.XValue].AxisLabel +" SelectedDatapointValue = "+dP.YValues[0].ToString();

}

Try in your own way. This is my method. If I could understand your question, I could write here more clearly.

Note: The above function is an Event, given in MSChart (ToolTip Event). You can also use MouseMove Event.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900