Click here to Skip to main content
15,889,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi experts,

I have a data table like
Name   percentahe   count
xxx       10%                   1
yyy       40%                    4

I wanted to bind name and percentage column to asp .net pie chart
as x and y value member and count column i wanted to show as tooltip of pie chart
presently am not able to bind the 3rd column

Plz help me
thanks in advance
(Keerthi Kumar)
Posted
Updated 10-Apr-14 23:37pm
v2
Comments
Naz_Firdouse 11-Apr-14 6:03am    
you mean to say you want to display count in tooltip and others are working fine?
Keerthi Kumar(Andar) 11-Apr-14 6:07am    
that count column values i want to show on tool tip on mouse over of each block
Keerthi Kumar(Andar) 11-Apr-14 6:05am    
ya.

This works fine for me
In aspx; I have the following code
ASP.NET
<chart:chart id="Chart1" runat="server" xmlns:chart="#unknown">
           <series>
               <chart:series name="Series1"></chart:series>
           </series>
           <chartareas>
               <chart:chartarea name="ChartArea1"></chart:chartarea>
           </chartareas>
       </chart:chart>

C#
DataTable dt = new DataTable();

 dt.Columns.Add(new DataColumn("Value1"));
 dt.Columns.Add(new DataColumn("Value2"));
 dt.Columns.Add(new DataColumn("Value3"));
 for (int i = 1; i <= 5; i++)
 {
     dt.Rows.Add("Hi" + i, 12*i, "Tooltip"+i);
 }

 Chart1.Series[0].XValueMember = "Value1";
 Chart1.Series[0].YValueMembers = "Value2";
 Chart1.Series[0].YValuesPerPoint = 5;
 Chart1.Series[0].ChartType = SeriesChartType.Pie;
 //Chart1.Series[0].ToolTip = "#VALY";
 Chart1.DataSource = dt;
 Chart1.DataBind();

 for(int cnt=0; cnt<chart1.series[0].points.count;cnt++>            {
     Chart1.Series[0].Points[cnt].ToolTip = dt.Rows[cnt]["Value3"].ToString();
 }
 
Share this answer
 
Comments
Keerthi Kumar(Andar) 15-Apr-14 3:15am    
thanks a lot Naz_Firdouse
here chart tag means asp tag or something else??
Naz_Firdouse 15-Apr-14 3:42am    
yes....
it refers System.Web.DataVisualization...
im my case it is like this
<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="chart" %>
Keerthi Kumar(Andar) 15-Apr-14 3:34am    
thanks a lot Naz_Firdouse...its working fine..
Naz_Firdouse 15-Apr-14 3:40am    
welcome
Keerthi Kumar(Andar) 16-Apr-14 4:57am    
Naz_Firdouse .. sorry for disturbing you.
i have got one more doubt dat.
how to display the count or total on top of multicolumn bar chart??
 
Share this answer
 
Comments
Keerthi Kumar(Andar) 11-Apr-14 6:22am    
thanks a lot for ur answer. but this is not the solution
Naz_Firdouse 11-Apr-14 6:28am    
any issues with that?
Keerthi Kumar(Andar) 11-Apr-14 7:09am    
ya... that is not the answer which i want.
Keerthi Kumar(Andar) 11-Apr-14 7:10am    
and also explanation is not sufficient
Naz_Firdouse 11-Apr-14 7:13am    
provide the code you have tried so that we can help you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900