Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Legend tooltip on a WinChart
posted

Hello, I'm trying to implement a tooltip on the legend of my winchart but its not working out...

 

I'm wanting to set up where, if I click on a label on the legend, the line on the chart will bold and then it checks to see if the line of the chart is bold in CHARTDRAWITEM and bold the label on the legend.  But for some reason, when I click the first label, it would bold everything.  I think I know the problem but I'm not sure how to fix this.  Please help me out.

 

 

 

 

Private Sub ChartDrawItem(ByVal sender As System.Object, ByVal e As Infragistics.UltraChart.Shared.Events.ChartDrawItemEventArgs)

        If e.Primitive.Path IsNot Nothing AndAlso e.Primitive.Path.IndexOf("Legend") <> -1 Then

 

            If e.Primitive.Row > -1 AndAlso e.Primitive.Column > -1 Then

 

                e.Primitive.Caps = Infragistics.UltraChart.Core.Primitives.PCaps.HitTest Or Infragistics.UltraChart.Core.Primitives.PCaps.Tooltip

                If e.Primitive.Path IsNot Nothing AndAlso e.Primitive.Path.ToLower.Contains("legend") Then

                    If TypeOf (e.Primitive) Is Box Then

                        LastPrimitive = e.Primitive

                        e.Primitive.Column = 0

                        ElseIf TypeOf (e.Primitive) Is Text Then

                            Dim t As Text = CType(e.Primitive, Infragistics.UltraChart.Core.Primitives.Text)

                            e.Primitive.Row = LastPrimitive.Row

                            e.Primitive.Column = LastPrimitive.Column

                            e.Primitive.Value = LastPrimitive.Value

 

                        End If

                    End If

 

 

                    If Me.tcResults.SelectedIndex < Me.charts.Count AndAlso _

                        TypeOf (e.Primitive) Is Infragistics.UltraChart.Core.Primitives.Text Then

 

                        Dim chart As UltraWinChart.UltraChart = charts(Me.tcResults.SelectedIndex)

 

                        Dim colNum As Integer = e.Primitive.Column

                        'colNum = 1

 

                        If colNum >= 0 AndAlso _

                            chart.LineChart.LineAppearances.Count > colNum AndAlso _

                            chart.LineChart.LineAppearances(colNum).Thickness = 8 Then

                            Dim pText As Infragistics.UltraChart.Core.Primitives.Text = DirectCast(e.Primitive, Infragistics.UltraChart.Core.Primitives.Text)

                            Dim tFont As Font = pText.labelStyle.Font

                            pText.labelStyle.Font = New Font(tFont.FontFamily, tFont.Size, FontStyle.Bold)

 

                        End If

                    End If

                Else

                    e.Primitive.PE.Fill = Color.White

                    e.Primitive.Caps = Infragistics.UltraChart.Core.Primitives.PCaps.None

                End If

                e.Primitive.Chart = Infragistics.UltraChart.Shared.Styles.ChartType.LineChart

            End If

 

    End Sub

 

Parents
  • 53790
    posted

    Hello Ninix,

    Maybe one possible approach to achieve desired bahvior could be if you are using events:

    - ultraChart1_DataItemOver()

    - ultraChart1_FillSceneGraph()

    Please take a look at the attached sample for more details and let me know if you have any questions

    Regards

    UltraChart3DPieChart.zip
Reply Children
No Data