Solved

How to create multiple xValueMembers in ASP Chart control

Posted on 2013-12-24
2
1,863 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

685 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