简体   繁体   中英

How to set migradoc chart x axis tickmarks

I assign manually values to the labels of the x-axis. Every 150 steps there should be a value. The rest is String.Empty . This part works perfectly.

Chart plotter = plotter_ref.Clone();

XSeries xseries = plotter.XValues.AddXSeries();
xseries.Add("0");
for (int i = 2; i <= 600; i++)
{
    if (i % 150 == 0)
    {
        xseries.Add(i.ToString());                    
    }
    else
    {
        xseries.Add(String.Empty);
    }
}

Now I would like to have Tickmarks at those points where the values are. I tried to set the MajorTickMark property

plotter.XAxis.MajorTick = 150;
plotter.XAxis.MajorTickMark = TickMarkType.Cross;
// or this 
//plotter.XAxis.MajorTickMark = TickMarkType.Inside;

But it has no effect:

在此处输入图片说明

What am I doing wrong?

If I take a closer look at the Tutorial in the sample chart section their example also does not show any x-axis ticks. Is it at all possible?

what if you did another trick? ie while printing the values there, you did like this:

xseries.Add( "+" + Environment.NewLine + i.ToString()) );

thus, it will insert like this:

--------------------------------------
           +          +
0         150        300

and just positioned 12pixel above?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM