PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Chart XAxis Wrap or 45 Degree Rotate
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3475
Page 1 of 1

Author:  joostehost [ Sat Oct 15, 2016 9:09 am ]
Post subject:  Chart XAxis Wrap or 45 Degree Rotate

Good day,

I have a problem with text in the XAxis being too big to fit. The problem is that I cannot decrease the text length as these are product names. Please see the current chart at https://www.dropbox.com/s/uksdyhb7dffl0pj/Capture.JPG?dl=0

I would like to either wrap the text to fit on multiple lines or rotate the text 90 degrees or 45 degrees.

How can this be done using MigraDoc?

The code I have at this stage is as follows (in C#):

Code:
Chart chart = new Chart();
        chart.Format.Alignment = ParagraphAlignment.Center;
        chart.Left = 0;
        chart.Width = MigraDoc.DocumentObjectModel.Unit.FromCentimeter(24);
        chart.Height = MigraDoc.DocumentObjectModel.Unit.FromCentimeter(12);
        Series series = chart.SeriesCollection.AddSeries();
        series.ChartType = ChartType.Column2D;
        series.FillFormat.Color = Color.FromCmyk(58, 32, 0, 26);
        series.LineFormat.Color = Color.FromCmyk(58, 32, 0, 26);
        series.Add(yVals);
        XSeries xseries = chart.XValues.AddXSeries();
        xseries.Add(xVals);
        chart.XAxis.MajorTickMark = TickMarkType.Outside;
        chart.XValues.First.Section.
        chart.YAxis.MajorTickMark = TickMarkType.Outside;
        chart.YAxis.HasMajorGridlines = true;
        chart.PlotArea.LineFormat.Color = Colors.DarkGray;
        chart.PlotArea.LineFormat.Width = 1;
        chart.WrapFormat.DistanceLeft = MigraDoc.DocumentObjectModel.Unit.FromCentimeter(0.2);
        chart.WrapFormat.DistanceTop = MigraDoc.DocumentObjectModel.Unit.FromCentimeter(6.6);
        chart.WrapFormat.Style = WrapStyle.Through;
        document.LastSection.Add(chart);


Thank you very much

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/