Reputation: 183
I have a small problem. In my chart not all the axislabels are shown, just a few. Just so you can see, here's what I'm refering
The code that I'm using is this :
foreach (KeyValuePair<string, values> value1 in chartStats)
{
DataPoint dp = new DataPoint();
dp.AxisLabel = value1.Key;
dp.YValues = new double[] { value1.Value.percent };
chart1.Series[0].Points.Add(dp);
DataPoint dp1 = new DataPoint();
dp1.YValues = new double[] { (double)value1.Value.angleSumHits };
chart1.Series[1].Points.Add(dp1);
}
I've tried changing the size of the chart but without any success.
Upvotes: 0
Views: 79
Reputation: 183
so for me volkan answer worked. the code part is this :
foreach (KeyValuePair<string, values> value1 in chartStats)
{
DataPoint dp = new DataPoint();
dp.AxisLabel = value1.Key;
dp.YValues = new double[] { value1.Value.percent };
chart1.Series[0].Points.Add(dp);
chart1.ChartAreas[0].AxisX.Interval = 1;
DataPoint dp1 = new DataPoint();
//dp1.AxisLabel = "a";
dp1.YValues = new double[] { (double)value1.Value.angleSumHits };
chart1.Series[1].Points.Add(dp1);
}
Upvotes: 0
Reputation: 6977
Try adding this:
chart1.ChartAreas[0].AxisX.Interval = 1;
But if you have too many datapoints the labels can overlap
Upvotes: 1