views:

23

answers:

1

Using Zedgraph (asp.net). I have a bar graph based on datetime x points. The first bar does not have a label. The first label is at the y-axis corresponding to a day before my first day point. I am not too concerned about this. However the second label is at the second bar. I need the first bar to have a label. I do have MyPane.XAxis.Scale.IsSkipFirstLabel = false.

How do I force the first bar to have a label? Why is ZedGraph not putting a label there?

Addition:

I want '5/20' to display for the first bar instead of 5/19 under the y-axis. I don't even have an entry for 5/19.

alt text

A: 

OK, I don't know if that's exactly what you need, but:

First, adjust your scale ranges manually:

zg1.MasterPane[0].XAxis.Scale.Min = (double)new XDate(2010, 05, 19);
zg1.MasterPane[0].XAxis.Scale.Max = (double)new XDate(2010, 05,30);

This will set the ranges of your scale to show one day before and one day after your data (this is needed to have extra space)

then, set the step:

 zg1.MasterPane[0].XAxis.Scale.MajorStep = 1;
 zg1.MasterPane[0].XAxis.Scale.FontSpec.Angle = 90f;

This will cause you will have one label for each day. In fact, this is the only way to have more or less control over the labels that appear. I've also changed the angle of labels (in normal position it would overlap).
But it would create the labels for first and last extra days too (margins). So we need to disable these two entries (now it would work, because you've set the ranges manually).

 zg1.MasterPane[0].XAxis.Scale.IsSkipFirstLabel = true;
 zg1.MasterPane[0].XAxis.Scale.IsSkipLastLabel = true;

If you just want to disable this first and last extra label and leave the rest to the ZedGraph, just ommit the second step. But the outcome could be sometimes unpredictable.

Gacek