Page 1 of 1

Labels on Stacked Bar Graph

Posted: Mon Apr 05, 2004 4:00 pm
by 8123955
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

Posted: Fri Apr 09, 2004 4:50 am
by Marjan
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.

Posted: Fri Apr 09, 2004 12:29 pm
by 8123955
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

Posted: Wed Apr 21, 2004 9:06 pm
by Pep
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.