Sign In  Sign Up Live-Chat

Truncating X-axis label

Last post 06-04-2008, 8:03 PM by roger. 3 replies.
Sort Posts: Previous Next
  •  06-03-2008, 4:33 AM 129765

    Truncating X-axis label

    Attachment: Present (inaccessible)

    Hi,

    I need to truncate the X-axis label or word wrap it.

    The labels are making the chart to appear smaller in size.

    Is there a way to truncate or word wrap x-axis label?

    I have attached the chart mentioning the problem due to the x-axis labels


    Saravana Kumar M.R
     
  •  06-03-2008, 5:18 AM 129775 in reply to 129765

    Re: Truncating X-axis label

    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
     
  •  06-03-2008, 5:52 AM 129780 in reply to 129775

    Re: Truncating X-axis label

    Hi,

     

    I am actually retrieving the x-axis labels from a table.

    So, is there a way to insert escape sequences into it?


    Saravana Kumar M.R
     
  •  06-04-2008, 8:03 PM 130106 in reply to 129780

    Re: Truncating X-axis label

    Hi,

    we will support it next week.


    Roger Mo
    Developer
    Aspose Nanjing Team
    Contact Us
     
View as RSS news feed in XML