On Bar series how to show Y value as Mark and Label
Posted: Wed Nov 28, 2012 4:04 pm
I'm new to TeeChart but am currently on an older version (v2) and am having difficult getting to grips with things so please excuse me.
I'm running in VS2010 targeting .NET 2.0.
My data consists of an Organisation Name and an Amount (summed).
I'm trying to programmatically show a Bar series where the Y value of the bar is the amount, the text under each bar (bottom axis) is the Organisation Name and at the top of each bar display the actual Y value.
I built a quick little app so I could play around rather than having to start my full app so I've got this:
ds is a single table DataSet. As you can see by the commented out line I tried a few things.
As it is above it displays the YValue at the top of each bar but the text on the bottom axis under each bar appears to be just some ordinal value starting at 0.
If I uncomment the LabelMember line above then I get the Organisation Name under each bar on the bottom axis but then it also shows it as the value above each bar.
Attempting to set the barSeries.XValues.DataMember just gives format exception because organisation name is a string.
This must surely be possible I just can't see how to do it. I've tried looking at both the series and axis tutorials in the HTML help docs but they don't shed much light. I tried loading the demo project but it crashes in VS2010 when you click on demo from the tree view when it attempts to Activator.CreateInstance(t).
Any help much appreciated.
I'm running in VS2010 targeting .NET 2.0.
My data consists of an Organisation Name and an Amount (summed).
I'm trying to programmatically show a Bar series where the Y value of the bar is the amount, the text under each bar (bottom axis) is the Organisation Name and at the top of each bar display the actual Y value.
I built a quick little app so I could play around rather than having to start my full app so I've got this:
Code: Select all
ClearChart();
using (var ds = GetPaymentsData())
{
var barSeries = new Bar();
tc.Series.Add(barSeries);
//barSeries.LabelMember = "OrganisationName";
barSeries.ColorEach = true;
barSeries.Marks.Visible = true;
barSeries.YValues.DataMember = "Amount";
barSeries.DataSource = ds;
}
As it is above it displays the YValue at the top of each bar but the text on the bottom axis under each bar appears to be just some ordinal value starting at 0.
If I uncomment the LabelMember line above then I get the Organisation Name under each bar on the bottom axis but then it also shows it as the value above each bar.
Attempting to set the barSeries.XValues.DataMember just gives format exception because organisation name is a string.
This must surely be possible I just can't see how to do it. I've tried looking at both the series and axis tutorials in the HTML help docs but they don't shed much light. I tried loading the demo project but it crashes in VS2010 when you click on demo from the tree view when it attempts to Activator.CreateInstance(t).
Any help much appreciated.