简体   繁体   中英

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

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

now i want to hide the c_score label for the marker points.

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

Thanks

on the form load im using the 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: -

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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