Pre loader

Axis GetMaximumRange() returns wrong value

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

0
0

Hello

I’m trying to acess ranges and build my code around this but Axis.GetMaximumRange() returns an incorrect value. It works correct after window_loaded event. What should I call to have correct range in axis?
I’ve attached sample project which shows 2 diagnostic traces, first is wrong, second is OK. Looks like while calling first renderable serie does not contain dataseries.

Attachments
  • You must to post comments
0
0

Hi there,

Axis.GetMaximumRange() calculates its range like this:

  • Foreach RenderableSeries in the Chart with YAxisId == this YAxis
  • Get the DataSeries
  • Get the associated XAxis for this RenderableSeries
  • Get the XAxis.VisibleRange
  •  Compute the YRange inside a window for this XRange
  •  Union all VisibleRanges

If your chart does not have DataSeries associated with the RenderableSeries, these will be ignored. This is expected.

Can you let me know what you are trying to do? Maybe there is another way,

Best regards,
Andrew

  • sahon
    Andrew, have you seen attached code? I attach dataserie via viemodel in xaml. But axis calculates MaxRange correctly only after Window Loaded.
  • Andrew Burnett-Thompson
    Hi Sahon, No I haven't looked at it yet - was trying to suggest workarounds for you to try first. You mentioned to me "Looks like while calling first renderable serie does not contain data series.". Without a DataSeries SciChart will not be able to calculate the GetMaximumRange() correctly. I would go and look at your bindings, check for binding errors, evaluable if the getter of your view model properties are being accessed via WPF binding and if the DataSeries are on the chart. If all else fails I can take a look.
  • sahon
    I do not think that this code has binding errors, only dataserie is binded via viewmodel, other staff is defined in xaml. With wrong bindings data will not be shown at all "Looks like while calling first renderable serie does not contain dataseries" is the reason of such wrong MaximumRange. I'm not so familiar with SciChart sources and I cannot say where in your code dataseries are binded to axis, that why I asked what should I call to make this relation work correctly. ZoomExtents and defining x,y axes IDs didn't help
  • Andrew Burnett-Thompson
    Ok - I will get someone to investigate this monday. Thanks for a solution to reproduce!
  • You must to post comments
0
0

Hi,

Don’t know if this one is still actual, but the issue appears because of bindings late update. If it is needed to correct data immediately in constructor of the control, it can be moved to SomeMethod and invoked in constructor with Task.Factory.StartNew(new Action(() => Dispatcher.BeginInvoke(new Action(SomeMethod)))), so that it is performed after all other interim tasks on UiThread.

Please, refer to the attached code-behind file from the sample.

Best regards,
Yuriy

Attachments
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies