This is a migrated thread and some comments may be shown as answers.
How to give tooltip in bar chart dynamically ?
1 Answer 72 Views
This is a migrated thread and some comments may be shown as answers.
Aravind
Top achievements
Rank 1
Aravind asked on 02 Jul 2013, 06:58 AM
Hai
  How to give tooltip in radhtml bar chart,i am plot bar chart dynamically,but default value is appear in tooltip if i mouse over in bars, below is my html code for bar chart
   <telerik:RadHtmlChart runat="server" ID="BarChart" Width="500px" Height="300px" Transitions="true" Skin="Forest">

                                                                                        <ChartTitle Text="DASHBOARD">
                                                                                            <Appearance Align="Center" BackgroundColor="White" Position="Top"></Appearance>
                                                                                        </ChartTitle>
                                                                                        <Legend>
                                                                                            <Appearance BackgroundColor="White" Position="Bottom"></Appearance>
                                                                                        </Legend>
                                                                                        <PlotArea>
                                                                                            <Appearance>
                                                                                                <FillStyle BackgroundColor="White"></FillStyle>
                                                                                            </Appearance>
                                                                                            <XAxis AxisCrossingValue="0" Color="#b3b3b3" Reversed="false">

                                                                                           
                                                                                            </XAxis>
                                                                                       
                                                                                            <YAxis AxisCrossingValue="0" Color="#b3b3b3">
                                                                                                <LabelsAppearance DataFormatString="{0}"></LabelsAppearance>

                                                                                            </YAxis>

                                                                                        </PlotArea>
                                                                                    </telerik:RadHtmlChart>


and my programatically plot code is 

                BarChart.PlotArea.Series.Clear()
                BarChart.PlotArea.XAxis.Items.Clear()

                Dim yaxis As New BarSeries()
                Dim yaxis1 As New BarSeries()
           
                yaxis.Name = "Pages"
                yaxis1.Name = "Files"

   For Each row As DataRow In dt.Rows
                      BarChart.PlotArea.XAxis.Items.Add(Convert.ToDateTime(row(0)).ToString("dd MMM"))

                        If (row(1).ToString = "") Then
                        Else
                            yaxis.SeriesItems.Add(row(1))
                            '  yaxis.TooltipsAppearance.DataFormatString = "{0} " + row(1) + " , {1} nnnnnnn"------here i try tooltip but bar chart value is appear ,i mean row(1) value is "6"
                        End If
                        If (row(2).ToString = "") Then
                        Else
                               yaxis1.SeriesItems.Add(row(2))
                      '  yaxis1.TooltipsAppearance.DataFormatString = "{0} " + row(1) + " , {1} nnnnnnn"---here i try tooltip but bar chart value is appear ,i mean row(2) value is "3"

                        End If
 Next
                BarChart.PlotArea.Series.Add(yaxis)
                BarChart.PlotArea.Series.Add(yaxis1)


pls reply asap
  Regards 
      Aravind

1 Answer, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 03 Jul 2013, 01:15 PM
Hello Aravind,

The format set by the DataFormatString property from the TooltipsAppearance element is a common for the whole series and cannot be unique for series items within the same series. The exception is the Bubble Series which has a ToolTip property exposed by each series item, so that you can specify a tooltip programmatically for each series item.

What you can do, however, in order to specify different tooltips/labels for series items is to use the ClientTemplate functionality. For more information on how to use ClientTemplate for tooltips and labels please refer to this online demo as well as to this help article.

Note also the ClientTemplate functionality is available only for a databound chart. That means if your chart is created programmatically then you can recreate your current logic, so that instead of creating items programmatically create a datasource which can be bound to the chart.

Regards,
Danail Vasilev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Asked by
Aravind
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Share this question
or