You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.
I have tried now to set the x-values for a line statistic to the major gridlines. But this does not work. This is how I try it in a ASP.NET MVC application:
var doc = new PdfDocument();
var page = doc.AddPage();
page.Orientation = PdfSharp.PageOrientation.Landscape;
page.Size = PdfSharp.PageSize.A4;
var gfx = XGraphics.FromPdfPage(page);
var chart = new Chart();
chart.Type = ChartType.Line;
chart.YAxis.MajorTickMark = TickMarkType.Outside;
chart.YAxis.LineFormat.Color = XColors.Black;
chart.YAxis.LineFormat.Width = 0.5;
chart.YAxis.LineFormat.Visible = true;
chart.YAxis.TickLabels.Format = "0";
chart.XAxis.MajorTickMark = TickMarkType.None;
chart.XAxis.MinorTickMark = TickMarkType.Outside;
chart.XAxis.LineFormat.Color = XColors.Black;
chart.XAxis.LineFormat.Width = 0.5;
chart.XAxis.LineFormat.Visible = true;
chart.XAxis.MajorTick = 0.0;
chart.XAxis.MinorTick = 0.0;
chart.XAxis.HasMajorGridlines = false;
chart.XAxis.HasMinorGridlines = false;
var series = chart.SeriesCollection.AddSeries();
var yValues = new int[]{ 0, 5, 3, 6, 7 };
series.HasDataLabel = true;
chart.PlotArea.LineFormat.Width = 1;
var xseries = chart.XValues.AddXSeries();
for(var i = 0; i < yValues.Length; i++)
{
series.Add(yValues[i]);
xseries.Add("abc");
}
series.LineFormat.Color = XColors.Orange;
series.MarkerStyle = MarkerStyle.None;
series.LineFormat.Width = 5;
chart.PlotArea.FillFormat.Color = XColors.White;
var chartFrame = new ChartFrame();
chartFrame.Location = new XPoint(20, 80);
chartFrame.Size = new XSize(400, 400);
chartFrame.Add(chart);
chartFrame.DrawChart(gfx);
var ms = new MemoryStream();
doc.Save(ms);
var fileBytes = ms.ToArray();
ms.Close();
return File(fileBytes, "application/pdf", "filename.pdf");
This is what I get:
But I expected the red line and the red lettering (drawn by hand):
How can I implement this? Is that even possible? Many thanks.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have tried now to set the x-values for a line statistic to the major gridlines. But this does not work. This is how I try it in a ASP.NET MVC application:
This is what I get:
But I expected the red line and the red lettering (drawn by hand):
How can I implement this? Is that even possible? Many thanks.
The text was updated successfully, but these errors were encountered: