Hi,
Is there any functionality to only increase the YAxis VisibleRange when the displayed data exceeds the initial VisibleRange?
Example: I’ve set the initial VisibleRange of the YAxis to min=0.0 and max=10.0. I don’t want the chart to AutoRange, because this range should be always visible even if the displayed values are smaller. But I want the VisibleRange to be increased by the set GrowBy value if the displayed data is smaller or higher than the initial range.
Is there any built-in functionality or do I have to care about that myself inside of the ViewModel?
Thanks!
- Joerg Hoehn asked 11 years ago
- You must login to post comments
Hi Joerg, the grow-by is a multiplying factor. You could try this:
Instead of
var currentRange = this.YAxis.VisibleRange.AsDoubleRange(); if (value > currentRange.Max) { var growByRange = this.YAxis.GrowBy.AsDoubleRange(); this.YAxis.VisibleRange.SetMinMax(0, currentRange.Max + growByRange.Max); }
try
// Decouple the instance so you don't modify original var currentRange = (DoubleRange)this.YAxis.VisibleRange.AsDoubleRange().Clone(); if (value > currentRange.Max) { // Expand range currentRange.Max = value; // Apply growby currentRange = currentRange.GrowBy(this.YAxis.GrowBy); this.YAxis.VisibleRange.SetMinMax(0, currentRange.Max); }
Also, a hidden feature in v1.5 will be the ability to put this logic into a “ViewportManager” derived class. This is called by SciChart in the render loop to get the new visible range, so it will be a good place to put this code.
Hope this helps!
- Andrew Burnett-Thompson answered 11 years ago
- You must login to post comments
Please login first to submit.