I am using Visual Studio 2010 and WFC to create a point graph of data. To create my chart I have a datatable with 3 different columns; these are Date, Value and Serial. This table is generated dynamically off of an SQL query and then I plot the Date on the x axis and Value on the y axis. What I am trying to achieve is that when the mouse is over a point on the chart then a tool tip shows the Date, Value and the unique Serial relating to these values. At the moment I am using
myChart.Series["mySeries"].ToolTip = "XValue = #VALY \r\nDate = #VALX{d}";
however obviously this does not show the serial number against these values. I tried using a ToolTip event however had some problems when trying to convert from datapoint in pixels to an exact plot on the graph. I hope this question makes sense.
I solved the problem, with thank to @vikas. Rather than try to assign a generic tool tip I have assigned an individual tool tip for each point.
int points = 0;
//For every row in the values table, plot the date against the variable value
foreach (DataRow row in Values.Rows)
{
myChart.Series[Variable].Points.AddXY(Convert.ToDateTime(row["Date"].ToString()), row["Variable"].ToString());
myChart.Series[Variable].Points[points].ToolTip = Variable + " = #VALY \r\nDate = #VALX{d} \r\nSerial = " + row["Serial"].ToString();
points += 1;
}
So the counter starts at 0 then for every row in the datatable Values 1 is added to the number of points and a Unique ToolTip is assigned for each point individually.