PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Wed Nov 25, 2020 2:57 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Wed Nov 04, 2020 10:28 am 
Offline

Joined: Wed Nov 04, 2020 10:23 am
Posts: 2
Hello,

So far, so good, I can create a chart using migradoc:
Code:
private Chart CreatePdfChart(IEnumerable<IDictionary<string, object>> topHundred)
        {
            Chart chart = new Chart();
            chart.Left = 0;
            chart.Width = Unit.FromCentimeter(16);
            chart.Height = Unit.FromCentimeter(12);
            Series series = chart.SeriesCollection.AddSeries();
            series.ChartType = ChartType.Line;
            series.MarkerStyle = MarkerStyle.None;
            series.LineFormat.Color = Colors.Red;
            XSeries xseries = chart.XValues.AddXSeries();
            int i = 0;
            foreach (var point in topHundred)
            {
                var value = point["Value"].ToString().Trim();
                CultureInfo ci = CultureInfo.InvariantCulture;
                var b = double.TryParse(value, NumberStyles.AllowDecimalPoint, ci, out var d);
                if (b)
                {
                    series.Add(d);
                }
                else
                {
                    series.Add(0);
                }
                var date = (DateTime.Parse(point["Date"].ToString())).ToString("d/M/yyyy H:m:s");
                if (i%10==0)
                {
                    xseries.Add(date);
                }
                else
                {
                    xseries.AddBlank();
                }
                i++;
            }
            chart.XAxis.MajorTickMark = TickMarkType.Outside;
            chart.XAxis.Title.Caption = "Time";
 
            chart.YAxis.MajorTickMark = TickMarkType.Outside;
            chart.YAxis.HasMajorGridlines = true;
 
            chart.PlotArea.LineFormat.Color = Colors.Black;
            chart.PlotArea.LineFormat.Width = 1;

            return chart;
        }

It works lovely.
However a question, is it possible to rotate clockwise by 90° XSerie labels? I looked at many sites or forum and I didn't find any answer.
Thanks in advance for your help,

Kind regards,


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group