Pre loader

Specify the distance between major-axis in exact Millimetres or Centimetres

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums


Hi everyone,

I’m working on a 2D chart on Android that requires the distance between major axes to be exactly 5 millimetres. How do I configure the major axis delta/ticks or resize the chart to meet my need?

Thank you.

  • You must to post comments

Hi Natasya,

Well you can create custom TickProvider with DeltaCalculator to calculate desired dimensions:

public class CustomNumericTickProvider extends NumericTickProvider {
    private final CustomNumericDeltaCalculator deltaCalculator;

    public CustomNumericTickProvider(float majorTickSizeMm) {
        this(new CustomNumericDeltaCalculator(majorTickSizeMm));

    public CustomNumericTickProvider(CustomNumericDeltaCalculator deltaCalculator){
        this.deltaCalculator = deltaCalculator;

    public void attachTo(IServiceContainer services) {

        deltaCalculator.axis = axis;

    public void detach() {
        deltaCalculator.axis = null;


    public static class CustomNumericDeltaCalculator extends NumericDeltaCalculator {
        private final float majorSizeInPixels;
        private IAxisCore axis;

        public CustomNumericDeltaCalculator(float majorSizeMm) {
            // calculate how many device pixels are in 5mm on screen
            majorSizeInPixels = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_MM, majorSizeMm, Resources.getSystem().getDisplayMetrics());

        protected IAxisDelta<Double> calculateDeltaInternal(double min, double max, int minorsPerMajor, int maxTicks) {
            final ICoordinateCalculator coordCalc = axis.getCurrentCoordinateCalculator();

            // calculate how many data representation of 5mm for current VisibleRange
            final double doubleDelta = Math.abs(coordCalc.getDataValue(majorSizeInPixels) - coordCalc.getDataValue(0f));

            return new AxisDelta<>(doubleDelta / minorsPerMajor, doubleDelta);

Then apply it for both X and Y axes:

    xAxis.setTickProvider(new CustomNumericTickProvider(5f));
    yAxis.setTickProvider(new CustomNumericTickProvider(5f));

Is this suitable for your needs?

Best regards,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.