简体   繁体   English

隐藏mscharts中标记点的标签

[英]hide label for marker points in mscharts

In mscharts im able to give label to the marker points using the function databindcrosstable using the code 在mscharts中,无法使用代码使用函数databindcrosstable给标记点添加标签

Chart1.DataBindCrossTable(dr, "something", "anything", "a_data", "label=c_score")

now i want to hide the c_score label for the marker points. 现在我想隐藏标记点的c_score标签。

I m showing the label in the tooltip on mouse hover using the code 我使用代码在鼠标悬停的工具提示中显示标签

e.Text = result.Series.Points(result.PointIndex).YValues(0) & vbCr & result.Series.Points(result.PointIndex).Label

I was trying this code in customize event which still shows the marker labels 我在自定义事件中尝试了此代码,该事件仍然显示标记标签

Private Sub Chart1_Customize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Chart1.Customize
    For Each ser As Series In Chart1.Series
        For Each dp As DataPoint In ser.Points
            dp.IsValueShownAsLabel = False
        Next
    Next
End Sub

if there is anything as dp.labelvisible = false 如果dp.labelvisible = false

Thanks 谢谢

on the form load im using the databindcrosstable. 使用databindcrosstable在表单上加载即时消息。

In the form load i have added 在表单加载中,我添加了

For Each ser As Series In Chart1.Series
                    For Each dp As DataPoint In ser.Points
            dp.Tag = dp.Label
            dp.Label = ""
        Next
Next

and on the chart1 tooltiptext event i have done: - 并且在chart1工具提示文本事件中,我已经完成了:-

Private Sub Chart1_GetToolTipText(ByVal sender As Object, ByVal e As System.Windows.Forms.DataVisualization.Charting.ToolTipEventArgs) Handles Chart1.GetToolTipText
    Dim result As HitTestResult
    Select Case e.HitTestResult.ChartElementType
        Case ChartElementType.DataPoint
            result = e.HitTestResult
            e.Text = "Overall Quality: " & result.Series.Points(result.PointIndex).YValues(0) & " " & result.Series.Points(result.PointIndex).Tag
    End Select
End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM