0
votes


I am using microsoft line chart(version 3.5). Now, I want to display point cursor and its value when user hover on line chart.

For i.e. check this link and click on line series.
http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxchart/index.htm#demos/jqxchart/javascript_chart_line_series.htm

1

1 Answers

0
votes

Correct me if I'm wrong but I guess you are using Microsoft Chart Controls for .Net Framework, it's not very clear in your question.

Anyway, you can use a tooltip to show the values of the point where your mouse is hovering on.
Chart1.Series("Series1").ToolTip = "#VALX - #VALY"
This will show the X Value and the Y Value in a tooltip of the point you are hovering over.

Code example (visual basic):

' Creating the series
Dim series1 As New Series("Series1")

' Setting the Chart Type
series1.ChartType = SeriesChartType.Line

' Adding some points
series1.Points.AddXY(0, 10)
series1.Points.AddXY(1, 15)
series1.Points.AddXY(2, 13)
series1.Points.AddXY(3, 21)
series1.Points.AddXY(4, 9)
series1.Points.AddXY(5, 17)

' Add the series to the chart
Chart1.Series.Add(series1)

' Set the chart's height and width
Chart1.Width = 600
Chart1.Height = 600

' Set the chart's visuals
series1.Color = Drawing.Color.Red
series1.IsXValueIndexed = True

' Setting the X Axis
Chart1.ChartAreas("ChartArea1").AxisX.IsMarginVisible = True
Chart1.ChartAreas("ChartArea1").AxisX.Interval = 1
Chart1.ChartAreas("ChartArea1").AxisX.Maximum = [Double].NaN
Chart1.ChartAreas("ChartArea1").AxisX.Title = "x"
Chart1.ChartAreas("ChartArea1").AxisX.TitleFont = New Font("Sans Serif", 10, FontStyle.Bold)

' Setting the Y Axis
Chart1.ChartAreas("ChartArea1").AxisY.Interval = 2
Chart1.ChartAreas("ChartArea1").AxisY.Maximum = [Double].NaN
Chart1.ChartAreas("ChartArea1").AxisY.Title = "y"
Chart1.ChartAreas("ChartArea1").AxisY.TitleFont = New Font("Sans Serif", 10, FontStyle.Bold)

' Setting the mouse hover (tooltip)
series1.ToolTip = "#VALX - #VALY"