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.

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
    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
    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.