#XVAL显示数据索引(整数)而不是数组的字符串

时间:2018-04-13 07:07:21

标签: vb.net charts

我想知道为什么#XVAL显示索引(从0到3,因为那里有4个项目)而不是ex:"< 0.50%"等等。这将帮助我改变所需的输出,即"< 0.50%"

我也尝试过#AXISLABEL而且它没有用。

以下是代码片段:

Private Sub LoadGraphicChart()
    Try

        C1Chart2.ChartGroups(0).ChartData.SeriesList.Clear()
        ' Data 
        Dim items As String() = New String() {"< 0.50%", "0.50% - 1.00%", "1.00% - 2.00%", "> 2.00%"}
        Dim unitHData As Double() = New Double() {7 / 100, 0, 0, 1 / 100}
        'first try, populating the series
        Dim unitH As C1.Win.C1Chart.ChartDataSeriesCollection = C1Chart2.ChartGroups(0).ChartData.SeriesList
        'unitH.Clear()
        Dim series As ChartDataSeries = unitH.AddNewSeries
        series.Label = "Unit Holder"
        series.LineStyle.Color = Color.MediumPurple
        series.X.CopyDataIn(items)
        series.Y.CopyDataIn(unitHData)
        'tooltip
        C1Chart2.ToolTip.Enabled = True

        For Each ds As ChartDataSeries In unitH
            ds.TooltipText = "Series = {#TEXT}" + ControlChars.Cr + ControlChars.Lf + "X = {#XVAL}" + ControlChars.Cr + ControlChars.Lf + "Y = {#YVAL:0.00%}"
        Next ds
    End Try
End Sub

这就是工具提示目前的样子:

Image Example

1 个答案:

答案 0 :(得分:1)

从使用tooltiptext更改为CoordToDataIndex解决了我的问题。 以下是我如何使用它:

f1_score

结果(第一个数据):First Data

结果(上次数据):Last Data