Reputation: 3
My code has three bars and i need to make some space before them: it should start with some specific value, not 0;
What I have now
What I want to get (example)
Here is my code:
var ch = new Chart();
ch.Series.Clear();
var cha = new ChartArea();
ch.ChartAreas.Add(cha);
var datePlanSeries = new Series {ChartType = SeriesChartType.Bar };
var dateAgreedSeries = new Series { ChartType = SeriesChartType.Bar };
var dateFactSeries = new Series { ChartType = SeriesChartType.Bar };
datePlanSeries.Points.AddY(durationPlan);
dateAgreedSeries.Points.AddY(durationAgreed);
dateFactSeries.Points.AddY(durationFact);
// And what should I add to each series to "move" it?
ch.Series.Add(datePlanSeries);
ch.Series.Add(dateAgreedSeries);
ch.Series.Add(dateFactSeries);
Upvotes: 0
Views: 82
Reputation: 508
There is a chart type called Range Bar. Each datapoint takes 2 Y-values, think from-Y and to-Y. So instead of:
var datePlanSeries = new Series {ChartType = SeriesChartType.Bar }; ... datePlanSeries.Points.AddY(durationPlan);
You use:
var datePlanSeries = new Series { ChartType = SeriesChartType.RangeBar };
...
datePlanSeries.Points.Add(1, 10); // from Y = 1, to Y = 10
Upvotes: 1