SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.

Answered
0
0

Hi All,

I’m using a logarithmicNumericAxis but I think that’s irrelevant to the problem. I’ve set Major and Minor Delta’s to 1 and autoticks to false and this puts everything on the chart as i want it.

The problem appears when our data range Y values are very close together and fall between the limits of the deltas. SciChart does its thing and AutoRanges to best display the series but this means the Y axis has no scale values on it. The delta markers appear as you drag the axis down as you might expect.

Is there an easy way to tell SciChart to autoscale but include at least 1 major delta? or perhaps interrogate the chart to see if a delta is visible and rescale it manually if not?
Currently I’m considering checking the data prior to creating the series and setting the range accordingly.

Any thoughts would be appreciated 🙂

  • You must to post comments
Best Answer
0
0

Hi Stuart,

The AutoTicks feature is a bit simple, and allows basic control over a chart Axis tick frequency output.

If you want fine-grained control e.g. to adaptively change the ticks when zooming, then I suggest looking at the TickProvider feature.

Start by inheriting LogarithmicNumericTickProvider and overriding CalculateMajorTicks. The tickDelta passed in is a structure containing the MajorDelta and MinorDelta. You can control it directly here, then adjust if the output contains no values, e.g.

public class LogarithmicNumericTickProviderEx : LogarithmicNumericTickProvider
{
    protected override double[] CalculateMajorTicks(IRange<double> tickRange, IAxisDelta<double> tickDelta)
    {
        // Try to calculate with MinorDelta = 0.1, MajorDelta = 1
        var altDelta = new DoubleAxisDelta(0.1, 1);
        var result = base.CalculateMajorTicks(tickRange, altDelta);

        // If that fails to give any ticks, try to calculate with the default parameters passed in
        if (result == null || result.Length == 0)
            return base.CalculateMajorTicks(tickRange, tickDelta);

        return result;
    }

    // TODO: Do the same for CalculateMinorTicks
    //       
}

Hope this helps!

Best regards,
Andrew

  • Stuart McCullough
    Thanks Andrew - that'll give me something to play with if they change their minds back to the original requirement again. :-(
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.