Labels on Stacked Bar Graph

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
waynewil
Newbie
Newbie
Posts: 9
Joined: Wed Feb 25, 2004 5:00 am
Location: on-planet

Labels on Stacked Bar Graph

Post by waynewil » Mon Apr 05, 2004 4:00 pm

Hi,

I have a stacked bar graph with four series. To avoid a color showing up when it shouldn't, I set the series value to null when it should be zero (on advice of your support staff).

My problem is that when all four series are null, the column label (i.e. Datasource/Labels) gets set to its index (i.e. 0,1,2) instead of the proper label value (i.e. the one that is in the Datasource/field being used as the source for the label).

This results in the following unpleasant situation. I am graphing numbers for 12 months, say January to December. There are no values to graph for the first four months, then there are values for the next four months, then none again for the final four months. What I see as column labels are 0 to 11, whereas if the first column has a value, I see the proper descriptions. Any suggestions?

Waynewil

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Fri Apr 09, 2004 4:50 am

Hi.

The easeist solution would be to use a "fake" series (first series in series list) and use it only for displaying axis labels. You can use regular point series, set it's ShowInLegend property to false and also set it's Color property to System.Color.Empty. Something like this:

Code: Select all

      line1.ShowInLegend = false;
      line1.Color = System.Drawing.Color.Empty;
      line1.Add(0,"Jan");
      line1.Add(0,"Feb");
      line1.Add(0,"Mar");
      line1.Add(0,"Apr");
      // etc ...
The idea is to use the first (fake) series only for showing axis labels and other series only for displaying actual values.
Marjan Slatinek,
http://www.steema.com

waynewil
Newbie
Newbie
Posts: 9
Joined: Wed Feb 25, 2004 5:00 am
Location: on-planet

Post by waynewil » Fri Apr 09, 2004 12:29 pm

Marjan,

OK, so, currently the application is fed from a dataset consisting of 6 data fields (Desc1, Desc2, Value1, Value2, Value3, Value4. Are you saying that I create, say, a calculated fifth field (as first series), defaulting always to the value 0, and give it no color so it doesn't show up visually?

Wayne

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Apr 21, 2004 9:06 pm

Hi Wayne,

yes, or alternatively, you can also cycle through all records in dataset and manually add appropriate label value to series by using standard Add method.

Post Reply