Solved

How to create multiple xValueMembers in ASP Chart control

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mail.To.Add 5 28
VB net, code to modify xlsx file, and errors when it is ran on NON-developer PC... 2 26
vb.net 1 month apart 11 31
vb.net class 3 17
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

803 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