我正在使用microsoft折线图(版本3.5)。现在,我想在用户悬停在折线图上时显示点光标及其值。
要检查此链接并单击系列。
http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxchart/index.htm#demos/jqxchart/javascript_chart_line_series.htm
答案 0 :(得分:0)
如果我错了,请纠正我,但我猜你正在使用.Net Framework的Microsoft图表控件,你的问题不是很清楚。
无论如何,您可以使用工具提示显示鼠标悬停点的值。
Chart1.Series("Series1").ToolTip = "#VALX - #VALY"
这将在您悬停的点的工具提示中显示X值和Y值。
代码示例(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"