ChartTrackballController

3 posts, 0 answers
  1. Jan Skovhus
    Jan Skovhus avatar
    7 posts
    Member since:
    Mar 2014

    Posted 11 Dec 2014 Link to this post

    How can I Show Trackball for each series?

    For i = 0 To Me.RadListView1.Items.Count - 1
                    If RadListView1.Items(i).CheckState = Telerik.WinControls.Enumerations.ToggleState.On Then
                       Dim lii As Integer = RadListView1.Items(i).Value
                        Dim liText As String = RadListView1.Items(i).Text
                        ''SingleHistory = MeasureWS.SingleHistory(lii.ToString, TextBoxStart.Text, TextBoxEnd.Text, "120")
                        SingleHistory = MeasureWS.SingleHistory(lii.ToString, "", TextBoxStart.Text, TextBoxEnd.Text, "120")

                        Dim LineSeriesY As New LineSeries()
                        LineSeriesY.LegendTitle = liText
                        'LineSeriesY.Name = liText
                        Dim LineSeriesX As New LinearAxis()
                        LineSeriesX.HorizontalLocation = AxisHorizontalLocation.Left
                        LineSeriesX.AxisType = AxisType.Second
                        'LineSeriesX.Title = ""
                        LineSeriesY.VerticalAxis = LineSeriesX
                        LineSeriesY.HorizontalAxis = horizontalAxis
                        RadChartView1.Series.Add(LineSeriesY)

                        LineSeriesY.CategoryMember = "DateTime"
                        LineSeriesY.ValueMember = "PV"

                        LineSeriesY.DataSource = SingleHistory
                        'Form2.DataGridView1.DataSource = SingleHistory

                        Dim controler As New ChartTrackballController()
                        AddHandler controler.TextNeeded, AddressOf controler_TextNeeded
                        RadChartView1.Controllers.Add(controler)


                    End If
                Next


    Private Sub controler_TextNeeded(sender As Object, e As TextNeededEventArgs)
            Dim dataPoint As CategoricalDataPoint = TryCast(e.Points(0).DataPoint, CategoricalDataPoint)
            e.Text = String.Format("{0} : {1}", dataPoint.Category, dataPoint.Value)
    End Sub
  2. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 16 Dec 2014 Link to this post

    Hello Jan,

    Thank you for writing.

    You should add only one ChartTrackballController to the RadChartView.Controllers collection. Thus, in the ChartTrackballController.TextNeeded event you can specify the text which will be displayed:
    Sub New()
        InitializeComponent()
     
        Dim lineSeries As New LineSeries()
        lineSeries.DataPoints.Add(New CategoricalDataPoint(20, "Jan"))
        lineSeries.DataPoints.Add(New CategoricalDataPoint(22, "Apr"))
        lineSeries.DataPoints.Add(New CategoricalDataPoint(12, "Jul"))
        lineSeries.DataPoints.Add(New CategoricalDataPoint(19, "Oct"))
        Me.RadChartView1.Series.Add(lineSeries)
     
        Dim lineSeries2 As New LineSeries()
        lineSeries2.DataPoints.Add(New CategoricalDataPoint(18, "Jan"))
        lineSeries2.DataPoints.Add(New CategoricalDataPoint(15, "Apr"))
        lineSeries2.DataPoints.Add(New CategoricalDataPoint(17, "Jul"))
        lineSeries2.DataPoints.Add(New CategoricalDataPoint(22, "Oct"))
        Me.RadChartView1.Series.Add(lineSeries2)
     
        Dim controler As New ChartTrackballController()
        AddHandler controler.TextNeeded, AddressOf controler_TextNeeded
        RadChartView1.Controllers.Add(controler)
    End Sub
    Private Sub controler_TextNeeded(sender As Object, e As TextNeededEventArgs)
        Dim sb As New StringBuilder()
        For Each point As DataPointInfo In e.Points
            Dim dataPoint As CategoricalDataPoint = TryCast(point.DataPoint, CategoricalDataPoint)
            sb.AppendLine(String.Format("{0} : {1}", dataPoint.Category, dataPoint.Value))
        Next
        e.Text = sb.ToString()
    End Sub

    I hope this information helps. Should you have further questions, I would be glad to help.

    Regards,
    Desislava
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jan Skovhus
    Jan Skovhus avatar
    7 posts
    Member since:
    Mar 2014

    Posted 17 Dec 2014 Link to this post

    It works,

    Thanks
Back to Top