This is a migrated thread and some comments may be shown as answers.

How can I get the x-axis label when bound to a database

5 Answers 65 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 13 Jun 2011, 06:52 PM
Hello,

I have a radchart which is bound to a database.  When I click on a piece of the bar chart, I want to drill down to another chart based on the label of the piece they clicked.  For instance, if I have a bar chart with the number sold of apples/oranges on it, when I click on the apples colomn, I want to show another chart about apples.  How can I determine what the label is from the click method.  The args.seriesItem.name is "Item2", so that doesn't help.  Also, args.seriesItem.label.base.TextBlock.text is empty.

Thanks,

Eric

5 Answers, 1 is accepted

Sort by
0
Eric
Top achievements
Rank 1
answered on 13 Jun 2011, 07:10 PM

So I found out how to do it, although its not very clean:

 

 

string

 

 

name = args.Series.PlotArea.XAxis.Items[args.SeriesItem.Index].TextBlock.Text;


Eric

 

0
Evgenia
Telerik team
answered on 16 Jun 2011, 10:56 AM
Hi Eric,

You may also find our Drill Down demo useful for your scenario.

Greetings,
Evgenia
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Eric
Top achievements
Rank 1
answered on 16 Jun 2011, 06:43 PM
Year = args.SeriesItem.Index + 2003;
SqlDataSource2.SelectParameters[0].DefaultValue = Year.ToString();

...

int quarter = args.SeriesItem.Index + 1;
SqlDataSource3.SelectParameters[0].DefaultValue = Year.ToString();
SqlDataSource3.SelectParameters[1].DefaultValue = quarter.ToString();

....
lol, thats even more of a hack than I came up with. If the year, quarter, and month weren't all numbers, that wouldn't work at all. Also, you seem to already know that the year is going start at 2003. What if that was variable?

Eric
0
Evgenia
Telerik team
answered on 22 Jun 2011, 07:53 AM
Hi Eric,

Indeed the Drill-Down demo has hardcoded XValues. However you can set the Year to the MinValue of the XAxis if you want.

Greetings,
Evgenia
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Rusty
Top achievements
Rank 1
answered on 14 Feb 2012, 04:27 PM
I am trying to do the same thing. Did you ever find a better way?
Tags
Chart (Obsolete)
Asked by
Eric
Top achievements
Rank 1
Answers by
Eric
Top achievements
Rank 1
Evgenia
Telerik team
Rusty
Top achievements
Rank 1
Share this question
or