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
200
tooltip customization - multiple chartlayer
posted

I would like to customize the visualization of the UltraChart tooltips because I need to show on the tooltip of the chart other information from the DataTable that is linked to the information on the graph.

In my example, I use CompositeChart with multiple chartlayer, and each layer has some numeric series on it. 

I tried to use the IRenderLabel in a custom class, in a code similar to this (VB.NET):

    Public Sub SetCustomTooltipLabelRender(ByVal dt As DataTable, ByVal lstColMapping As List(Of Integer))
        Dim clTooltip As CustomToolTipLabelRender = New CustomToolTipLabelRender(Me.coChart)
        clTooltip.ReferenceDataTable = dt
        clTooltip.ColumnMappingForToolTips = lstColMapping
        Me.coChart.Tooltips.Format = TooltipStyle.Custom
        Me.coChart.Tooltips.FormatString = "<MY_TOOLTIP>"
        Me.coChart.LabelHash.Add("MY_TOOLTIP", clTooltip)
    End Sub

However, on the IRenderLabel.ToString(ByVal context As Hashtable) implementation, on the context I cannot receive any information on the chart layer that refers to the data where the mouse is over. The values:

   context("[DATA_ROW]")
   context("[DATA_COLUMN]")
 

Are not enough in composite and multiple chartlayer context. The value:

      context("[ITEM_SERIES]")

can be linked in some complicated way (looking at the Serie LabelColumn property of  the series linked to chartLayers) only if the series have different labels (in my example, this is not the case,  I need to use the same LabelColumn value for more series, I use different legend boxes in different positions to identify the difference among the series). 

I need a way to obtain the chartLayer in the IRenderLabel.ToString() implementation, because I must identify which serie I'm over with the mouse in order to link the correct information in the DataTable.

Is there any other way to customize tooltip for Composite Charts with multiple Chart Layers  without having those kind of limitations?

Andrea Lazzarini