Pre loader

Dragging Multiple Axis Marker Annotations

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

4
4

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.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
1.2.0.8
  • Kelvin Roy
    I am looking for exact same feature for a finance app. Android has this capability, can it be added to iOS as well? This is a deciding factor and we need to integrate as soon as possible
  • You must to post comments
2
1

Good day

There was bug in SCIModifierGroup. So you need latest version of SDK. You can get it at this link http://www.scichart.com/Downloads/iOS/v1.2/SciChart_iOS_v1.2.2.915_SDK.zip

You need to add some kind of hit test to your code to check what annotation to move.
After that you have to set the following option for SCIAnnotationGroup

[annotationGroup setHandleGestureFirstOnly:YES];

Taht means if annotation returns YES from gesture handler, gesture is considered handled and won’t be checked by other annotations. In that case when annotations are placed at the same position you can drag them separately.

Assuming you are using absolute coordinate mode for SCIAxisMarkerAnnotation placement:

 marker.coordMode = SCIAnnotationCoord_Absolute;

You can do the following:

@class CDAxisMarkerAnnotation;

@protocol CDAxisMarkerAnnotationDelegate <NSObject>

- (void)axisMarkerAnnotation:(CDAxisMarkerAnnotation *)axisMarkerAnnotation
           didPanToAxisValue:(double)axisValue;

@end

@interface CDAxisMarkerAnnotation : SCIAxisMarkerAnnotation

@property (weak, nonatomic) id<CDAxisMarkerAnnotationDelegate> delegate;

@end

@implementation CDAxisMarkerAnnotation {
    BOOL _gestureLocked;
}

- (BOOL)onPanGesture:(UIPanGestureRecognizer *)gesture At:(UIView *)view
{
    const BOOL GESTURE_HANDLED = YES;
    const BOOL GESTURE_NOT_HANDLED = NO;

    if (![view isKindOfClass:[SCIChartSurfaceView class]]) {
        return [super onPanGesture:gesture At:view];
    }

    CGPoint location = [gesture locationInView:view];
    id<SCIRenderSurface> renderSurface = [self.parentSurface renderSurface];
    CGPoint pointInChart = [renderSurface pointInChartFrame:location];
    id<SCICoordinateCalculator> yCalculator = [self.yAxis getCurrentCoordinateCalculator];
    double valueForYAxis = [yCalculator getDataValueFrom:pointInChart.y];

    switch (gesture.state) {
        case UIGestureRecognizerStateBegan: {
            double markerCoord = [yCalculator getCoordinateFrom:SCIGenericDouble(self.position)];
            const double hitTestDistance = 25;
            BOOL pointInHitTest = fabs(pointInChart.y - markerCoord) < hitTestDistance;
            if ( !pointInHitTest ) return GESTURE_NOT_HANDLED;
            _gestureLocked = YES;
            break;
        }
        case UIGestureRecognizerStateChanged:
            if (!_gestureLocked) return GESTURE_NOT_HANDLED;
//            [self.delegate axisMarkerAnnotation:self didPanToAxisValue:valueForYAxis];
            // I don't know what "axisMarkerAnnotation:didPanToAxisValue:" actually do, but the following code moves your axis marker and triggers redraw
            [self setPosition:SCIGeneric(valueForYAxis)];
            [renderSurface invalidateElement];
            break;
        case UIGestureRecognizerStateEnded:
            _gestureLocked = NO;
        default: {
            break;
        }
    }
    return GESTURE_HANDLED;
}

@end

Please let me know if you have troubles using that example

Best regards
Andrii
SciChart iOS Developer

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.