Solved

How to create multiple xValueMembers in ASP Chart control

Posted on 2013-12-24
2
1,765 Views
Last Modified: 2013-12-30
I have a chart control that looks like the attached image.  The control consists of 3 series and is bound to a dataset.  The xValuMember is bound to the "AcctName" column.  But what I need to do is combine the data in the AcctName column with the data in the AcctNumber column so my xvaluemember label is not just the account name but under it is the account number.

what the labels look like now
thanks in advance for the help.
0
Comment
Question by:mgmhicks
2 Comments
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 500 total points
ID: 39745834
The lack of response may indicate this is not easily possible the way you describe it.

How about this workaround: create a calculated column and use that for XValueMember instead of an existing column. Note: I only tested with a simplified version of your chart and data.
        Dim dt As New DataTable
        dt.Columns.AddRange(New DataColumn() {New DataColumn("AcctNumber", GetType(Integer)), New DataColumn("AcctName", GetType(String)), New DataColumn("Budget", GetType(Integer))})
        dt.Rows.Add({12345, "Cust 1", 567})
        dt.Rows.Add({12346, "Cust 2", 678})
        dt.Rows.Add({12347, "Cust 3", 789})
        Dim dc As New DataColumn("AcctNumberAndName", GetType(String), "'# ' + AcctNumber + ' : ' + AcctName")
        dt.Columns.Add(dc)
        Chart1.Series(0).XValueMember = "AcctNumberAndName"
        Chart1.Series(0).YValueMembers = "Budget"

        Chart1.DataSource = dt
        Chart1.DataBind()

Open in new window

EDIT: even easier might be of course to add a calculated column to your SQL query but I can't be sure how easy that would be in your situation.
0
 

Author Closing Comment

by:mgmhicks
ID: 39746207
thanks that Idea worked
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now