Hi,
Yes you may uitlize escape sequence char i.e., "\n" for wraping the x-axis label text.
Kindly check the following sample code:
Chart c = new Chart();
c.ChartArea.AxisY.DefaultLabel.Font = new System.Drawing.Font("Arial", 8);
c.ChartArea.AxisX.DefaultLabel.Font = new System.Drawing.Font("Arial", 10);
c.ChartArea.AxisX.AxisLabels.IsDataPointNameVisible = true;
c.ChartArea.AxisX.DefaultLabel.FontAngle = 25;
c.ChartArea.AxisX.IntervalType = IntervalType.String;
c.ChartArea.Transparence = 255;
c.ChartArea.AxisY.IsAutoCalc = false;
c.ChartArea.AxisY.Interval = 6531;
c.ChartArea.AxisY.Minimum = 0;
c.ChartArea.AxisY.Maximum = 39186;
c.ChartArea.AxisY.IntervalType = IntervalType.Int;
c.ChartArea.AxisX.IsMajorGridVisible = false;
c.ChartArea.AxisY.IsMajorGridVisible = false;
c.ChartArea.AxisX.IsMinorGridVisible = false;
c.ChartArea.AxisX2.IsVisible = false;
c.ChartArea.AxisY2.IsVisible = false;
Series s0 = new Series();
s0.ChartType = ChartType.Bar;
s0.Name = "Values";
DataPoint dp = new DataPoint("Equity Fund\nHigh Dividend", 16900);
dp.IsLabelVisible = true;
s0.DataPoints.Add(dp);
dp = new DataPoint("KBC Equity \nFund QuantEurope", 22000);
dp.IsLabelVisible = true;
s0.DataPoints.Add(dp);
dp = new DataPoint("Equity Fund \nFinace", 30000);
dp.IsLabelVisible = true;
s0.DataPoints.Add(dp);
dp = new DataPoint("Equity Fund \nCyclicals", 39186);
dp.IsLabelVisible = true;
s0.DataPoints.Add(dp);
c.SeriesCollection.Add(s0);
//Save the chart image into a memory stream.
MemoryStream ms = new MemoryStream();
c.Save(ms, ImageFormat.Png);
//Save the chart image from the memory stream to the response.
Response.Clear();
Response.ContentType = "image/png";
Response.OutputStream.Write(ms.ToArray(), 0, (int)ms.Length);
Thank you.
Amjad Sahi
Support Developer,
Aspose Nanjing Team
Contact Us