K
K
kwayne2017-12-07 10:19:01
.NET
kwayne, 2017-12-07 10:19:01

C# How to place chart columns and labels strictly one above the other?

Friends help me understand how to place the chart columns strictly above their captions?
The screenshot shows the current version. I need to make all columns look like "Application #2". Below is the stripped-down code used to display such a chart.
5a28e83d351c9078663171.png

ChartArea chArea = new ChartArea("Заявки");
chArea.AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount;
chArea.AxisX.Title = "Тип заявки";
chArea.AxisY.IntervalAutoMode = IntervalAutoMode.VariableCount;
chArea.AxisY.Title = "Количество заявок";

chart1.ChartAreas.Add(chArea);

Series seriesOper = new Series();
seriesOper.AxisLabel = "Заявка № 1"; 
var dp1 = seriesOper.Points.Add(1035); // значение по Y
chart1.Series.Add(seriesOper);

Series seriesPlan = new Series();
seriesPlan.AxisLabel = "Заявка № 2"; 
var dp2 = seriesPlan.Points.Add(861); // значение по Y 
chart1.Series.Add(seriesPlan);

chart1.AlignDataPointsByAxisLabel(); // выравнивание столбцов по подписям осей. Без этого все столбцы стоят вплотную и подписи отсутствуют.

Thank you!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question