Insufficient Amount of Ticks on the Axis

Originally Posted 19 October 2016, 3:16 am EST

  • Originally Posted 19 October 2016, 3:16 am EST

    Hello,

    I have some trouble with the automatic tick placement in some scenarios.
    If the axis range is small, like from 1 to 1.1 or even smaller, there are only 1-2 ticks placed on the axis (see screenshot).

    Is there any way to force the library to place more ticks on the axis?

    Thank you in advance for any help,

    Michael

  • Reply

    Hi Michael,

    You can set the Axis' UnitMajor/UnitMinor properties to change the intervals at which the Major/Minor ticks are drawn. For example the following code draws major ticks at an interval of 0.025 on the Y-axis(see screenshot)
    c1Chart.ChartArea.AxisY.UnitMajor = 0.025;


    Regards,
    Ankit

  • Reply

    Hi Ankit,

    thanks for the quick response.

    Is there any way to force the chart to set a fix amount of ticks on the axis?

    Otherwise the interval for the major ticks has to be determined new every time the data is changed or the size of the chart is changed.

    Best Regards,
    Michael
  • Reply



    Hi Ankit,

    I have encountered another problem. In some cases there is a tick missing on the axis when I set the UnitMajor properties as you can see in the picture.

    Is there any workaround?

    Best Regards,
    Michael


  • Marked as Answer

    Reply

    Hi Michael,

    C1Chart doesn't have any property/method to fix the the number of ticks on the axis. The major tick interval would need to be determined new as you have said. You can divide the axis range with the number of ticks required to auto-calculate the UnitMajor.

    var n = 10;  //number of ticks required
    double range = c1Chart1.ChartArea.AxisY.Max - c1Chart1.ChartArea.AxisY.Min;
    c1Chart1.ChartArea.AxisY.UnitMajor = range /n;


    Regarding the 2nd issue I could not reproduce it at my end. It appears to be something related with the AxisY Min. Can you please share a small sample(or the chart xml) reproducing this?

    Regards,
    Ankit
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels