ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Display data in Tooltip on Pie Chart Mouse Hover using C# and VB.Net in ASP.Net<p>Hi <a class="username" rel="akhter"> akhter</a>,</p> <p>Check this example. Now please take its reference and correct your code.</p> <p><strong><span style="text-decoration: underline;">Database</span></strong></p> <p>For this example I have used of Northwind database that you can download using the link given below.</p> <p><a href="https://www.aspsnippets.com/Articles/Install-Microsoft-Northwind-and-Pubs-Sample-databases-in-SQL-Server-Management-Studio.aspx" target="_blank">Download Northwind Database</a></p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <pre class="brush: html">&lt;asp:Chart ID=&#34;EmployeeChartInfo&#34; runat=&#34;server&#34; Height=&#34;450px&#34; Width=&#34;1590px&#34;&gt; &lt;Titles&gt; &lt;asp:Title ShadowOffset=&#34;3&#34; Name=&#34;Items&#34; /&gt; &lt;/Titles&gt; &lt;Legends&gt; &lt;asp:Legend Alignment=&#34;Center&#34; Docking=&#34;Bottom&#34; IsTextAutoFit=&#34;False&#34; Name=&#34;Default&#34; LegendStyle=&#34;Row&#34; /&gt; &lt;/Legends&gt; &lt;Series&gt; &lt;asp:Series Name=&#34;Default&#34; /&gt; &lt;/Series&gt; &lt;ChartAreas&gt; &lt;asp:ChartArea Name=&#34;ChartArea1&#34; BorderWidth=&#34;1&#34; /&gt; &lt;/ChartAreas&gt; &lt;/asp:Chart&gt;</pre> <p><strong><span style="text-decoration: underline;">Namespaces</span></strong></p> <p><strong>C#</strong></p> <pre class="brush: csharp">using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Web.UI.DataVisualization.Charting;</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Imports System.Configuration Imports System.Data Imports System.Data.SqlClient Imports System.Web.UI.DataVisualization.Charting</pre> <p><strong><span style="text-decoration: underline;">Code</span></strong></p> <p><strong>C#</strong></p> <pre class="brush: csharp">protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { GetEmployeeChartInfo(); } } private void GetEmployeeChartInfo() { DataTable dt = new DataTable(); using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[&#34;constr&#34;].ConnectionString)) { con.Open(); SqlCommand cmd = new SqlCommand(&#34;SELECT shipcity as Sections, count(orderid) AS Total FROM orders where shipcountry = &#39;UK&#39; group by shipcity&#34;, con); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); con.Close(); } string[] x = new string[dt.Rows.Count]; int[] y = new int[dt.Rows.Count]; for (int i = 0; i &lt; dt.Rows.Count; i++) { x[i] = dt.Rows[i][0].ToString(); y[i] = Convert.ToInt32(dt.Rows[i][1]); } EmployeeChartInfo.Series[0].Points.DataBindXY(x, y); EmployeeChartInfo.Series[0].ChartType = SeriesChartType.Pie; EmployeeChartInfo.ChartAreas[&#34;ChartArea1&#34;].Area3DStyle.Enable3D = true; EmployeeChartInfo.Legends[0].Enabled = true; EmployeeChartInfo.Series[0].ToolTip = &#34;Total : #VALY&#34;; }</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load If Not IsPostBack Then GetEmployeeChartInfo() End If End Sub Private Sub GetEmployeeChartInfo() Dim dt As DataTable = New DataTable() Using con As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings(&#34;constr&#34;).ConnectionString) con.Open() Dim cmd As SqlCommand = New SqlCommand(&#34;SELECT shipcity as Sections, count(orderid) AS Total FROM orders where shipcountry = &#39;UK&#39; group by shipcity&#34;, con) Dim da As SqlDataAdapter = New SqlDataAdapter(cmd) da.Fill(dt) con.Close() End Using Dim x As String() = New String(dt.Rows.Count - 1) {} Dim y As Integer() = New Integer(dt.Rows.Count - 1) {} For i As Integer = 0 To dt.Rows.Count - 1 x(i) = dt.Rows(i)(0).ToString() y(i) = Convert.ToInt32(dt.Rows(i)(1)) Next EmployeeChartInfo.Series(0).Points.DataBindXY(x, y) EmployeeChartInfo.Series(0).ChartType = SeriesChartType.Pie EmployeeChartInfo.ChartAreas(&#34;ChartArea1&#34;).Area3DStyle.Enable3D = True EmployeeChartInfo.Legends(0).Enabled = True EmployeeChartInfo.Series(0).ToolTip = &#34;Total : #VALY&#34; End Sub</pre> <p><strong><span style="text-decoration: underline;">Screenshot</span></strong></p> <p><img src="https://i.imgur.com/xocqOTL.jpg" alt="" width="368" height="406" /></p>https://www.aspforums.net:443/Threads/119482/Display-data-in-Tooltip-on-Pie-Chart-Mouse-Hover-using-C-and-VBNet-in-ASPNet/https://www.aspforums.net:443/Threads/119482/Display-data-in-Tooltip-on-Pie-Chart-Mouse-Hover-using-C-and-VBNet-in-ASPNet/Tue, 15 Oct 2019 06:55:41 GMT