Pre loader

VisibleRange is not working on a specific number

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

1
0

I am considering applying server-side licensing for my javerScript application.

In the document below, there is a phrase “Our server-side licensing component is written in C++.”
(https://support-dev.scichart.com/index.php?/Knowledgebase/Article/View/17256/42/)

However, there is only asp.net sample code on the provided github.
(https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-dotnet-server-licensing)

I wonder if there is a sample code implemented in C++ for server-side licensing.

Can you provide c++ sample code?
Also, are there any examples to run on Ubuntu?

Version
2.0.2146
  • You must to post comments
0
0

Hi Gang,

In order to zoom back to original scale after panning and zooming in for details we need a chart modifier. Right now in SciChart.js we do not have a chart modifier that does exactly what you need. However, it is quite easy to create a custom one.

This is an example how to create a custom MouseWheelZoomModifier which does exactly what you need

import {
    IMouseWheelZoomModifierOptions,
    MouseWheelZoomModifier
} from 'scichart/Charting/ChartModifiers/MouseWheelZoomModifier';
import { ModifierMouseArgs } from 'scichart/Charting/ChartModifiers/ModifierMouseArgs';
import { easing, TEasingFn } from 'scichart/Core/Animations/EasingFunctions';
import { NumberRange } from 'scichart/Core/NumberRange';

export class CustomMouseWheelZoomModifier extends MouseWheelZoomModifier {
    protected isExtendsRangeSet: boolean = false;

    constructor(options?: IMouseWheelZoomModifierOptions) {
        super(options);
    }

    public modifierMouseWheel(args: ModifierMouseArgs): void {
        console.log('modifierMouseWheel');
        if (!this.isExtendsRangeSet) {
            this.parentSurface.xAxes.asArray().forEach(xAxis => {
                xAxis.zoomExtentsRange = new NumberRange(xAxis.visibleRange.min, xAxis.visibleRange.max);
                console.log('xAxis.zoomExtentsRange', xAxis.zoomExtentsRange.min, xAxis.zoomExtentsRange.max);
            });
            this.isExtendsRangeSet = true;
        }
        super.modifierMouseWheel(args);
    }

    public modifierDoubleClick(args: ModifierMouseArgs) {
        console.log('modifierDoubleClick');
        if (this.isExtendsRangeSet) {
            const animationDuration = 500;
            const easingFunction: TEasingFn = easing.outExpo;
            this.parentSurface.zoomExtentsX(animationDuration, easingFunction);
            this.isExtendsRangeSet = false;
        }
    }
}

You will find the full working Zoom Extends to Original Scale Demo here

Best regards,
Michael

  • Gang Xu
    awesome, thanks.
  • You must to post comments
1
0

Another question. My data is longer than preset visible range. I’d like the chart can zoom in and out on x axis, and can return back to original scale (the visible range before zooming started by mouse wheel) with a double-clicking. For example, the visible x axis range was 0-10 at the very beginning. I dragged the chart to 2-12. And I zoomed in to see details. Finally I double-click to return to the original scale which is 10 seconds long. The final x range should be 2-12, instead of 0-10.

Is there a way to achieve that? I read the documentation and didn’t fully understand how the property zoomExtentsToInitialRange works.
https://www.scichart.com/documentation/js/current/webframe.html#ZoomExtentsModifier.html

please advise. Many thanks.

  • 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