0

I want to know why #XVAL shows the index (from 0 to 3 since there is 4 items in there) instead of ex:"< .50%" and so on. This will help me to change the desired output, which is "< .50%".

I've tried #AXISLABEL too and it doesn't work.

Here is a snippet of the code:

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

This is what the tooltip currently looks like:

Image Example

2
  • Everything looks fine. What is your problem? I don't understand your question. items[0] = "< 0.50%" contains 7/100 Commented Apr 13, 2018 at 7:15
  • @cSteusloff oh sorry, my question is, how to change the output of #XVAL from (0) to ("< 0.50%) in the tooltiptext Commented Apr 13, 2018 at 7:25

1 Answer 1

1

Changing from using tooltiptext to CoordToDataIndex solved my problems. Here is how I use it:

Private Sub C1Chart2_MouseClick(sender As Object, e As MouseEventArgs) Handles C1Chart2.MouseClick
    Dim SeriesOutput As Integer
    Dim PointOutput As Integer
    Dim DistanceOutput As Integer
    Dim items As String() = New String() {InputLabel10.Text, InputLabel9.Text, InputLabel8.Text, InputLabel7.Text}
    Dim unitHData As String() = New String() {FormatPercent((CDbl(lblPersen00.Text) / 100)), FormatPercent((CDbl(lblPersen05.Text) / 100)), FormatPercent((CDbl(lblPersen10.Text) / 100)), FormatPercent((CDbl(lblPersen20.Text) / 100))}

    C1Chart2.ChartGroups.Group0.CoordToDataIndex(e.X, e.Y, CoordinateFocusEnum.XandYCoord, SeriesOutput, PointOutput, DistanceOutput)

    Debug.WriteLine("Series Index : " & SeriesOutput.ToString())
    Debug.WriteLine("Point Index : " & PointOutput.ToString())
    Debug.WriteLine("Distance from Point: " & DistanceOutput.ToString())

    'MessageBox.Show(PointOutput)
    If PointOutput.ToString <> "" Then
        MessageBox.Show("X : " & items(PointOutput) & ControlChars.Cr & ControlChars.Lf & "Y : " & unitHData(PointOutput))
    End If

End Sub

Result(First Data): First Data

Result(Last Data): Last Data

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.