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

Tick mark on horizontal axis...
https://forum.pdfsharp.net/viewtopic.php?f=3&t=408
Page 1 of 1

Author:  ldelabre [ Sat Jun 14, 2008 4:35 pm ]
Post subject:  Tick mark on horizontal axis...

Hi !

I couldn't get tick marks on a horizontal axis (using MigraDoc w/ PdfSharp), after comparing HorizontalXAvisRenderer and VerticalYAxisRenderer, here's the trick :

Changes in PDFsharp\Charting\Charting\PdfSharp.Charting.Renderers\HorizontalXAxisRenderer.cs

inside Draw(), at line 160 after
Code:
      LineFormatRenderer lineFormatRenderer = new LineFormatRenderer(gfx, xari.LineFormat);

add the following
Code:
      LineFormatRenderer minorTickMarkLineFormat = new LineFormatRenderer(gfx, xari.MinorTickMarkLineFormat);
      LineFormatRenderer majorTickMarkLineFormat = new LineFormatRenderer(gfx, xari.MajorTickMarkLineFormat);


then at line 176 replace
Code:
          lineFormatRenderer.DrawLine(points[0], points[1]);

with
Code:
          minorTickMarkLineFormat.DrawLine(points[0], points[1]);


and at line 194 replace
Code:
          lineFormatRenderer.DrawLine(points[0], points[1]);

with
Code:
          majorTickMarkLineFormat.DrawLine(points[0], points[1]);


This work it out for me ;)

Have a nice day !

Author:  motamman [ Wed Jan 07, 2009 8:06 pm ]
Post subject:  devilish xaxis major/minorticks

So i thought maybe your solution would solve my problem.

Nope.

the yaxis minor/major ticks work perfectly but the xaxis majortick is always = 1 and minortick = 0.5. (BTW that's the default set up in HorizontalXAxisRenderer and VerticalXAxisRenderer.)

the process is getting into the loop that I believe is setting the major and minor values but the value isn't changing. There has to be something wrong with the variables used in that loop but I haven't found it yet.

Anyone had any luck fixing this?

Cheers,
Mo

Author:  SiGa [ Mon Feb 25, 2019 10:21 am ]
Post subject:  Re: Tick mark on horizontal axis...

Having the same Problem and also in the Hello MigraDoc example there are no x-axis tickmarks.
Just wanted to inform readers that this isn't fixed yet.

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