Link to home
Start Free TrialLog in
Avatar of spen_lang
spen_lang

asked on

VB.Net Charts

Hi,

I am using the chart control in Microsoft Visual Basic studio 2010 express.

I have a pie chart that shows the amount of records per name. The chart is connected to a dataset datatable that is populated by a database query. The datatable contains 3 columns; Name, ID, TotalRecords.

On my pie chart I am showing the xValue as name (so that the labels are readable and not ust a ID) and yValue as TotalRecords. Is there anywhere I can store the ID for later use against the series?

The reason I ask is because I would like to use this ID later to populate the parameters of a database query when the use clicks on particular section of the pie chart...
ASKER CERTIFIED SOLUTION
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of spen_lang
spen_lang

ASKER

Thank you that works great!

One more question... Is it possible to use all three data fields in the tooltip for the series and also adding addition writting.

E.g. Tooltip as follow

ID = 1
Name = Ted
Total = 100
sure, try this:
Chart1.Series(0).ToolTip = "ID: #CUSTOMPROPERTY(ID)\nName: #VALX\nTotal: #VALY"

Open in new window

Is there any way to format the tooltip custom property, e.g. UCase..?
Hmm, I don't think so, no function calls possible from that string AFAIK. Would be easier to do it in the sql, add a new field if neccessary.
Ok, thanks for your help.

If you have time could you take a look at another question I have posted on .NET charts?

https://www.experts-exchange.com/questions/28701244/VB-NET-Creating-a-line-chart.html
I had a quick look, but seems you almost have a solution there now.

Good to see you're already using the techniques learned from this solution! (if I may be so bold ;-)