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.
- sahon asked 10 years ago
- You must login to post comments
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
- Andrew Burnett-Thompson answered 10 years ago
-
Andrew, have you seen attached code? I attach dataserie via viemodel in xaml. But axis calculates MaxRange correctly only after Window Loaded.
-
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.
-
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
-
Ok - I will get someone to investigate this monday. Thanks for a solution to reproduce!
- You must login to post comments
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
- Yuriy Zadereckiy answered 10 years ago
- You must login to post comments
Please login first to submit.