Pre loader

Category: iOS

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

0 votes
13k views

Hi,

I’ve been looking through ways to have to y-Axis scale for really small changes/values.

For example, I’m attempting to plot 10 values between 0.99300 to 0.99400, and the changes between points can vary between 0.001 to 0.0001 or so (basically, really small changes)

However, my y-Axis seems to always start at 0 and the y-Axis major ticks are always at most a 0.1 difference, making the graph look flat.

I’d like to achieve the following:
– Scale to the smallest value i can scale to.
– Have my y-Axis to not necessarily start at 0.

I’ve tried the following:

Setting up y-Axis:

    self.yAxis = [SCINumericAxis new];
    [self.yAxis setStyle:axisStyle];
    self.yAxis.axisId = @"yAxis";
    [self.yAxis setGrowBy:[[SCIDoubleRange alloc]initWithMin:SCIGeneric(0) Max:SCIGeneric(0.1)]];
    [self.yAxis setAutoRange:SCIAutoRange_Always];
    [self.chartSurface attachAxis:self.yAxis IsXAxis:NO];

Regards.

0 votes
7k views

Hi, guys

I want to show two renderableSeries on one chart view. These series have common x-axis (SCICategoryDateTimeAxis) and separate y-axes(SCINumericAxis). Only one of y-axis is visible at chart view. Also the data series of visible renderable series updated by scrolling to left or to right. So for displaying on one view i’m using:

[y1Axis setGrowBy: [[SCIDoubleRange alloc] initWithMin:SCIGeneric(0.3) Max:SCIGeneric(0.07)]];
[y2Axis setGrowBy: [[SCIDoubleRange alloc] initWithMin:SCIGeneric(0.0) Max:SCIGeneric(5)]];

So it’s look good at start (Correct_zooming.png). But after some scrolling it decrease axis extents of invisible y-axis (decrease.png).
Or even breaks down (broken.png)

For test i’m using SCIFastOhlcRenderableSeries and SCIHorizontallyStackedColumnsCollection readerable series.
Data series for SCIHorizontallyStackedColumnsCollection is initializated like:

    [volumeSerie1 updateAt:index Y:SCIGeneric(100000 / [multiplier doubleValue])];
    [volumeSerie2 updateAt:index Y:SCIGeneric(500000 / [multiplier doubleValue])];

So can you look at it?
Or what way i should implement this behavior?

Best regards,
Sushynski Andrei

0 votes
14k views

Hi guys,

I am having difficulties setting the background of my bar chart with SCICategoryDateTime X axis since I switched to 2.0.

As far as I understand, just setting the background property of the SCIChartSurface should suffice.
These are all of the things I’ve tried:

1. [self.barSurface setBackgroundColor:[UIColor clearColor]];
2. [self.barSurfaceView setBackgroundColor:[UIColor clearColor]]; 
3. self.barSurface.renderableSeriesAreaFill = [[SCISolidBrushStyle alloc] initWithColor:[UIColor clearColor]];
4. [self.barSurface.renderSurface setIsTransparent:YES];

I didn’t find any other way of setting it, but it still remains black. Any thought on what might cause it?

EDIT: I just found out about this color setting:

[axisStyle setGridBandBrush:[[SCISolidBrushStyle alloc] initWithColor:[UIColor whiteColor]]];

The result I got was a black and white chess board, as shown on the attached picture. I really don’t understand this behaviour. If I set this gridBandBrush to nil, columns are coloured with random colours, so the chart looks like a rainbow. I understand why is this happening but shouldn’t there be a default colour in case brush is nil?

EDIT 2: While debugging using “Capture view hierarchy” in XCode I discovered that render surface is actually white inside debugger. Perhaps it will give more insight to you, it doesn’t mean much to me – I guess it’s because rendering is done on GPU and the context is not available to the debugger.

Best,
Igor

  • Igor Peric asked 7 years ago
  • last active 7 years ago
1 vote
11k views

I’ve got error message during compilation:

 ld: bitcode bundle could not be generated because '.../Frameworks/SciChart.framework/SciChart' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build for architecture armv7

I temporary disabled bitcode for target. Will you fix it in the next build?

1 vote
5k views

Hello,

I recently updated 2 different apps that both use SciChart with XCode14 and uploaded the archives to the App Store via Organizer. They both generated the warning/error:

“The app references non-public selectors in …/Frameworks/SciChart.framework/SciChart: moveToX:y:”

This did not occur with Xcode 13.

Any advice on how best to handle this?

Thank you.

  • C Bolton asked 2 years ago
  • last active 1 year ago
1 vote
4k views

Hello,

I need to display realtime chart with 20 series of data. My data is arriving at 500Hz. When I’m displaying this data, I find that after a while SciChart hangs with what appears to be a deadlock.

I’ve read as much as I can find about realtime graphing with SciChart and I started with tutorial 4 – Adding Realtime Updates. This article (https://www.scichart.com/questions/wpf/is-xydataseries-safe-to-being-changed-in-a-separate-thread) suggests that SciChart is thread safe so I tried using a second thread to feed data into a graph. My only change was to move from the main thread timer in the example to a GCD timer running at 500Hz. With this, I’m easily able to reproduce the deadlock in around 1.5 seconds.

Here is the main thread which is attempting to render:

Thread 1 Queue : com.apple.main-thread (serial)
#0  0x0000000192bc8c20 in __psynch_rw_rdlock ()
#1  0x0000000192ae4864 in _pthread_rwlock_lock_wait ()
#2  0x0000000192ae47fc in _pthread_rwlock_lock_slow$VARIANT$mp ()
#3  0x0000000104a93828 in -[SCIRenderableSeriesLock initWithRenderableSeries:] ()
#4  0x0000000104ab742c in -[SCIRenderSurfaceRenderer p_SCI_updateCoreData:renderPassState:viewportSize:] ()
#5  0x0000000104ab6f4c in -[SCIRenderSurfaceRenderer p_SCI_renderLoop:assetManager:renderPassState:] ()
#6  0x0000000104ab6dc4 in -[SCIRenderSurfaceRenderer onDrawWithContext:andAssetManager:] ()
#7  0x00000001049c50c0 in -[SCIRenderSurfaceDrawable2D drawFrameIn:withDrawableSize:] ()
#8  0x0000000104ad4db8 in -[SCITwisterRendererBase drawFrameIn:withDrawableSize:] ()
#9  0x00000001049e56c8 in -[SCIMetalRenderer drawFrameIn:withDrawableSize:] ()
#10 0x0000000104a25b70 in -[SCIMetalRenderSurfaceBase draw] ()
#11 0x00000001999861ec in -[CALayer display] ()
#12 0x00000001999984d4 in CA::Layer::layout_and_display_if_needed(CA::Transaction*) ()
#13 0x00000001998e11d8 in CA::Context::commit_transaction(CA::Transaction*, double) ()
#14 0x000000019990ab78 in CA::Transaction::commit() ()
#15 0x000000019990b58c in CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) ()
#16 0x0000000192d50fbc in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#17 0x0000000192d4beb0 in __CFRunLoopDoObservers ()
#18 0x0000000192d4c32c in __CFRunLoopRun ()
#19 0x0000000192d4bc38 in CFRunLoopRunSpecific ()
#20 0x000000019d39a38c in GSEventRunModal ()
#21 0x0000000196e7c444 in UIApplicationMain ()
#22 0x00000001042cc478 in main at /Users/mall/Downloads/SciChart.iOS.Examples-SciChart_v3_Release/tutorials/tutorials-2d/Tutorial 04 - Adding Realtime Updates/Tutorial 04 - Adding Realtime Updates/AppDelegate.swift:5
#23 0x0000000192bd38f0 in start ()

and here is my worker thread adding data to a series:

Thread 11 Queue : com.apple.root.default-qos.overcommit (concurrent)
#0  0x0000000192bc8c20 in __psynch_rw_rdlock ()
#1  0x0000000192ae4864 in _pthread_rwlock_lock_wait ()
#2  0x0000000192ae47fc in _pthread_rwlock_lock_slow$VARIANT$mp ()
#3  0x0000000104ac1518 in -[SCIXDataSeries p_SCI_searchDataIndexOn:xMinAsDouble:xMaxAsDouble:downSearchMode:upSearchMode:] ()
#4  0x0000000104ac1368 in -[SCIXDataSeries getIndicesXRange:xMinAsDouble:xMaxAsDouble:isCategoryAxis:] ()
#5  0x0000000104ac1b34 in -[SCIXDataSeries getWindowYRangeWithXCoordCalc:getPositiveRange:] ()
#6  0x0000000104aceddc in -[SCIRenderableSeriesBase getYRange:positive:] ()
#7  0x00000001049b25ac in -[SCIRangeCalculationHelper2DBase getWindowedYRangeWithXCalculators:] ()
#8  0x0000000104a05f84 in -[SCIAxisBase getWindowedYRangeWithXRanges:] ()
#9  0x00000001049f4184 in -[SCIChartSurface p_SCI_zoomExtentsYWithCalculators:andDuration:] ()
#10 0x00000001049f3d14 in -[SCIChartSurface p_SCI_zoomExtentsWithDuration:] ()
#11 0x00000001042c79e8 in closure #1 in ViewController.handleTimer() at /Users/mall/Downloads/SciChart.iOS.Examples-SciChart_v3_Release/tutorials/tutorials-2d/Tutorial 04 - Adding Realtime Updates/Tutorial 04 - Adding Realtime Updates/ViewController.swift:84
#12 0x00000001042c7500 in thunk for @escaping @callee_guaranteed () -> () ()
#13 0x0000000104abdae0 in +[SCIUpdateSuspender usingWithSuspendable:withBlock:] ()
#14 0x00000001042c7824 in ViewController.handleTimer() at /Users/mall/Downloads/SciChart.iOS.Examples-SciChart_v3_Release/tutorials/tutorials-2d/Tutorial 04 - Adding Realtime Updates/Tutorial 04 - Adding Realtime Updates/ViewController.swift:79
#15 0x00000001042c9250 in partial apply ()
#16 0x00000001042cb1e4 in closure #1 in closure #1 in RepeatingTimer.timer.getter at /Users/mall/Downloads/SciChart.iOS.Examples-SciChart_v3_Release/tutorials/tutorials-2d/Tutorial 04 - Adding Realtime Updates/Tutorial 04 - Adding Realtime Updates/RepeatingTimer.swift:26
#17 0x00000001042c7500 in thunk for @escaping @callee_guaranteed () -> () ()
#18 0x0000000107093730 in _dispatch_client_callout ()
#19 0x0000000107096390 in _dispatch_continuation_pop ()
#20 0x00000001070a9614 in _dispatch_source_invoke ()
#21 0x00000001070a4d74 in _dispatch_root_queue_drain ()
#22 0x00000001070a5698 in _dispatch_worker_thread2 ()
#23 0x0000000192aeab38 in _pthread_wqthread ()

Here is my version of the ViewController class from Tutorial 4 with the GCD timer (note that it uses RepeatingTimer class found here: https://gist.github.com/danielgalasko/1da90276f23ea24cb3467c33d2c05768) – my changes are marked with the //MALL comment:

import UIKit
import SciChart

class ViewController: UIViewController {

    //MALL
    private var timer = RepeatingTimer(timeInterval: 1.0/500.0)

    private let pointsCount = 200
    private var count: Int = 0

    private let lineData = SCIDoubleValues()
    private lazy var lineDataSeries: SCIXyDataSeries = {
        let lineDataSeries = SCIXyDataSeries(xType: .int, yType: .double)
        lineDataSeries.seriesName = "Line Series"
        lineDataSeries.fifoCapacity = 300
        return lineDataSeries
    }()
    private let scatterData = SCIDoubleValues()
    private lazy var scatterDataSeries: SCIXyDataSeries = {
        let scatterDataSeries = SCIXyDataSeries(xType: .int, yType: .double)
        scatterDataSeries.seriesName = "Scatter Series"
        scatterDataSeries.fifoCapacity = 300
        return scatterDataSeries
    }()

    private var surface: SCIChartSurface {
        return view as! SCIChartSurface
    }

    override func loadView() {
        viewRespectsSystemMinimumLayoutMargins = false
        view = SCIChartSurface()
    }

    override func viewDidLoad() {
        super.viewDidLoad()

        let xValues = SCIIntegerValues()
        for i in 0 ..< pointsCount {
            xValues.add(Int32(i))
            lineData.add(sin(Double(i) * 0.1))
            scatterData.add(cos(Double(i) * 0.1))
            count += 1
        }
        lineDataSeries.append(x: xValues, y: lineData)
        scatterDataSeries.append(x: xValues, y: scatterData)

        let lineSeries = SCIFastLineRenderableSeries()
        lineSeries.dataSeries = lineDataSeries

        let pointMarker = SCIEllipsePointMarker()
        pointMarker.fillStyle = SCISolidBrushStyle(colorCode: 0xFF32CD32)
        pointMarker.size = CGSize(width: 10, height: 10)

        let scatterSeries = SCIXyScatterRenderableSeries()
        scatterSeries.dataSeries = scatterDataSeries
        scatterSeries.pointMarker = pointMarker

        let legendModifier = SCILegendModifier()
        legendModifier.orientation = .horizontal
        legendModifier.position = [.bottom, .centerHorizontal]
        legendModifier.margins = UIEdgeInsets(top: 0, left: 0, bottom: 10, right: 0)

        SCIUpdateSuspender.usingWith(self.surface) {
            self.surface.xAxes.add(items: SCINumericAxis())
            self.surface.yAxes.add(items: SCINumericAxis())
            self.surface.renderableSeries.add(items: lineSeries, scatterSeries)
            self.surface.chartModifiers.add(items: SCIPinchZoomModifier(), SCIZoomExtentsModifier())
            self.surface.chartModifiers.add(items: SCIRolloverModifier(), legendModifier)
        }

        //  MALL
        timer.eventHandler = handleTimer
        timer.resume()
    }

    //  MALL
    private func handleTimer() {
        let x = count
        SCIUpdateSuspender.usingWith(surface) {
            self.lineDataSeries.append(x: x, y: sin(Double(x) * 0.1))
            self.scatterDataSeries.append(x: x, y: cos(Double(x) * 0.1))

            // zoom series to fit viewport size into X-Axis direction
            self.surface.zoomExtents()
            self.count += 1
        }
    }
}

Thanks in advance for any help you can offer.

0 votes
8k views

Hi,

I’ve encountered an issue with the candlestick graph I’ve drawn that consists of a set of random X date time values – this causes the candlesticks have varying distances from one another.

Rendering the data from an initial set seems to be fine but as I run a NSTimer to add on more points, the body of the new candlesticks seem to be 0. (Note, the date time values are still random but have been made to be set after the last placed point)

In fact, the initial data points that I added see to be rendered ‘body-less’ if it’s within the same visible range as the newly added points. And if I pan along the newly added points, the bodies of some data points will appear at random visible ranges.

Is this a normal behaviour or should I take anything else into consideration?

Here are a couple of my configurations which I think may have affected anything:
1. My XAxis has set its visible range limit mode to ClipMode_Min
2. Candlestick series style data body width is set to be default.
3. I have a the following modifiers set up.

self.xDragModifier = [SCIXAxisDragModifier new];
self.xDragModifier.axisId = @"xAxis";
self.xDragModifier.dragMode = SCIAxisDragMode_Pan;
self.xDragModifier.clipModeX = SCIZoomPanClipMode_ClipAtMin;
[self.xDragModifier setModifierName:@"XAxis DragModifier"];

self.pinchZoomModifier = [[SCIPinchZoomModifier alloc] init];
[self.pinchZoomModifier setModifierName:@"PinchZoom Modifier"];
self.pinchZoomModifier.xyDirection = SCIXYDirection_XDirection;

self.zoomPanModifier = [SCIZoomPanModifier new];
self.zoomPanModifier.clipModeX = SCIZoomPanClipMode_ClipAtMin;
self.zoomPanModifier.xyDirection = SCIXYDirection_XDirection;
[self.zoomPanModifier setModifierName:@"ZoomPan Modifier"];

SCIModifierGroup * gm = [[SCIModifierGroup alloc] initWithChildModifiers:@[self.xDragModifier, self.pinchZoomModifier, self.zoomPanModifier]];
self.chartSurface.chartModifier = gm;

The points are drawing just fine, but the body of the candlestick is not appearing as expected.

Thanks in advance.

  • Elle Yeoh asked 7 years ago
  • last active 7 years ago
1 vote
9k views

Hello,
I’ve been looking for the documentation of how to customize the look of the chart. I have a black/dark gray checker pattern that seems to be the default. I would like to:
1. Change the background to white, no checkerboard pattern
here is the documentation for chart background but it does not show me how to change it to white. https://www.scichart.com/documentation/ios/v2.x/webframe.html#The%20SciChartSurface%20Type.html
I have found through experimentation the I can call

surface.backgroundColor

But that just changes the axis background color

2. Make the text larger on the axis.
here is the documentation for the axis https://www.scichart.com/documentation/ios/v2.x/webframe.html#Adding%20an%20Axis%20to%20a%20SciChartSurface.html
I see these lines that were provided but they won’t compile because Xcode doesn’t know what defaultFontSize is and there are no other references to it and I still don’t see a way to set the size.

textFormat.fontName = SCSFontsName.defaultFontName
textFormat.fontSize = SCSFontSizes.defaultFontSize

I think it would be helpful to create a walkthrough for iOS that shows how to customize the background and axis. I’ve looked through the samples provided but the files are huge and I get lost trying to figure it out.
Thanks,
Warren

1 vote
5k views

I’m try to generate a UIImage from a SCIChartSurface into a graphic context using the code below from a view that is not displayed on the screen. The image created is pure black, which indicates it did not draw. If I display the graph in a view on the devices screen, the graph draws correctly.

UIGraphicsBeginImageContextWithOptions(self.chart.bounds.size, NO, 0.0);
[self.chart drawViewHierarchyInRect:self.chart.bounds afterScreenUpdates:YES];
UIImage *chartImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

Are there any special steps that are needed to draw into a graphic context?

0 votes
5k views

When search this forum, I found that we can achieve it by adding point marker. But I am getting this error when trying to add point marker :
‘Operation: setPointMarker: is not avaliable on type: SCIHorizontallyStackedColumnsCollection’

let me know this feature(round top corners of bars) is availble or not ! Or is there any way to do this ?

0 votes
7k views

https://www.scichart.com/documentation/ios/v2.x/Tutorial%2002%20-%20Creating%20a%20SciChartSurface.html

Can someone please point me to where I can complete this tutorial.

Why end this tutorial like this??

// That’s it! The SCIChartSurface will now display on the screen with default axis ranges

As is, it simply displays the x and y values. Nothing else.

How can I add my x and y values so that I can display my graph

1 vote
2k views

Hello, I’m new to Swift and macOS, but I’m tasked to research SciChart. I have started my macOS trial, got my trial code from the wizard app. I’m following the Creating your first SciChart macOS App tutorial but I get Sorry! Your license token appears to be invalid error.

Here is what I’ve tried:

import Cocoa
import SciChart
import AppKit

@main
class AppDelegate: NSObject, NSApplicationDelegate {

//    override init() {
//        SCIChartSurface.setRuntimeLicenseKey("XXX")
//    }

    func applicationDidFinishLaunching(_ aNotification: Notification) {
        let licenseKey = "XXX"
        SCIChartSurface.setRuntimeLicenseKey(licenseKey)
    }

    func applicationWillTerminate(_ aNotification: Notification) {
        // Insert code here to tear down your application
    }

    func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
        return true
    }
}

Using override init() leads to Terminating app due to uncaught exception 'License Exception', reason: ''
Using SCIChartSurface.setRuntimeLicenseKey() in applicationDidFinishLaunching leads to Sorry! Your license token appears to be invalid. Please contact support with your OrderID if you believe this to be incorrect.

What am I doing wrong?

0 votes
2k views

Hi, guys

My x axis is SCICategoryDateTimeAxis class type. And it’s limited by VisiableRangeLimit like:

[xAxis setVisibleRangeLimit:[[SCIDoubleRange alloc] initWithMin:SCIGeneric(firstItem – (lastItem – priorItem))
Max:SCIGeneric(lastItem + (lastItem – priorItem))]];

Also for scrolling my content inside chart:

SCIZoomPanModifier * zpm = [[SCIZoomPanModifier alloc] init];
[zpm setModifierName:@"PanZoom Modifier"];
[zpm setClipModeX:SCIZoomPanClipMode_ClipAtExtents];

Like a description SCIZoomPanClipMode_ClipAtExtents says:
“forces the panning operation to stop suddenly at the extents of the data” – but it’s not working constantly.
Sometimes it’s allow to scroll outside the range. Like on the attached image.

So my question is how to limit scrolling by min and max value?

Best regards,
Sushynski Andrei

2 votes
9k views

From your documentation:

4.9 Annotations

SciChart features a rich Annotations API, that allows you to place UIKit UIElements over the chart.
SciChat provides a number of built-in annotations, but you can also create your own.

SCIBoxAnnotation, SCILineAnnotation and SCITextAnnotation are cool, but sometimes it’s not enough.

Is it possible to render UIView on the chart (at least UIImage)?
Is it possible to draw dashed line annotation?
Could you provide an example of creating custom annotation class?

0 votes
6k views

Hi, guys

What is the minimum required sdk version for SciChart v.2?

Such as i have some trouble with IOS 9. See attachment.

Same behavior at real devices.

Can you look at this?

Best regards,
Sushynski Andrei

0 votes
5k views

We need to generate adhoc ipa file for review purpose and we are using the trial version, but its fails. Can you help us on the same?

0 votes
4k views

Hi,

I’m trying to convert Java code to swift and I need the same CustomCategoryDateAxis class as Yura’s answer: https://www.scichart.com/questions/android/setvisiblerangelimitmode-on-xaxis

I try to inherit from SCICategoryDateAxis but there is no isZoomConstrainSatisfied and coerceVisibleRange overrides.

How can i write the same code in swift?

Tnx.

1 vote
5k views

I didn’t see anything in any docs, so I am just wanting to verify this info…

Is this correct that you have to link in and ship the libSwiftCore (+ other swift libs) with an app using SciCharts on iOS? When I added the chart library to my app; the app crashed at startup with missing dynamic load of libSwiftCore.dylib on a real device (emulators run fine).

Enabling ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES in the build settings fixed this issue. But this surprised me that the SciChart library would actually require Swift.

Was this intentional; or did the library somehow pickup an unintentional reference somewhere….

0 votes
9k views

Hi

I am developing a Xamarin iOS application and I’m using a SCIPieChartSurface. I can create the chart and set its values, but is is not possible to auto-update the donut with new data.
I am trying to update the value by doing:

myDonut.MyPieSegment.Value = newValue;

But nothing happends…

I heard it was a bug in the API for Android a month ago, is this similar? Or am I doing something wrong?
Thanks in advance!

Best regards
Jonas

0 votes
6k views

Hi all,

I’m trying to use the metal support in a little test project.
I have following lines to enable metal:

if SCIChartSurface.isMetalSupported {
      sciChartSurface.renderSurface = SCIMetalRenderSurface(frame: sciChartSurface.bounds)
 } else {
       sciChartSurface.renderSurface = SCIOpenGLRenderSurface(frame: sciChartSurface.bounds)
 }

the surface keeps empty until I remove the

sciChartSurface.renderSurface = SCIMetalRenderSurface(frame: sciChartSurface.bounds)

line – or in other words I use OpenGL.
Then the chart will render properly. I am using an iPhoneX (not simulator).

Thank you for your support!

Wall of Code:

import UIKit
import SciChart
import SnapKit

class ViewController: UIViewController {

    // MARK: - UIElements
    private var sciChartSurface: SCIChartSurface!

    // MARK: - Vars
    private var series: SCIXyDataSeries?

    // MARK: - Lifecycle
    override func viewDidLoad() {
        super.viewDidLoad()
        setupSurface()
        setupData()
        renderData()
    }

       // MARK: - Chart
     private func setupSurface() {
        // Create a SCIChartSurface. This is a UIView so can be added directly to the UI
        sciChartSurface = SCIChartSurface.init(frame: view.bounds)
        sciChartSurface.debugWhySciChartDoesntRender = true
        view.addSubview(sciChartSurface)

        // Detect metal with this static property
        if SCIChartSurface.isMetalSupported {
            sciChartSurface.renderSurface = SCIMetalRenderSurface(frame: sciChartSurface.bounds)
        } else {
            sciChartSurface.renderSurface = SCIOpenGLRenderSurface(frame: sciChartSurface.bounds)
        }
        sciChartSurface.snp.makeConstraints { (make) in
            make.edges.equalToSuperview()
        }

        sciChartSurface.translatesAutoresizingMaskIntoConstraints = true
        sciChartSurface.backgroundColor = .gray
        // Create an XAxis and YAxis. This step is mandatory before creating series
        let xAxis = SCICategoryNumericAxis()
        setup(axis: xAxis)
        sciChartSurface.xAxes.add(xAxis)
        let yAxis = SCINumericAxis()
        setup(axis: yAxis)
        sciChartSurface.yAxes.add(yAxis)
    }

    private func setup(axis: SCIAxisBase) {
        let axisStyle = SCIAxisStyle()

        let majorPen = SCISolidPenStyle(colorCode: 0xFF393532, withThickness: 0.5)
        let minorPen = SCISolidPenStyle(colorCode: 0xFF262423, withThickness: 0.5)

        let textFormat = SCITextFormattingStyle()
        textFormat.fontSize = 16

        axisStyle.majorTickBrush = majorPen
        axisStyle.majorGridLineBrush = majorPen
        axisStyle.gridBandBrush = SCISolidBrushStyle(colorCode: 0xE1232120)
        axisStyle.minorTickBrush = minorPen
        axisStyle.minorGridLineBrush = minorPen
        axisStyle.labelStyle = textFormat
        axisStyle.drawMinorGridLines = true
        axisStyle.drawMajorBands = true
        axis.style = axisStyle
    }

    private func setupData() {
        series = SCIXyDataSeries(xType: .int16, yType: .int16)
        TestData.testData.forEach { (testData) in
            let xGeneric = SCIGenericType(type: .int16, .init(int32Data: testData.x))
            let yGeneric = SCIGenericType(type: .int16, .init(int32Data: testData.y))
            series?.appendX(xGeneric, y: yGeneric)
        }
    }

    private func renderData() {
        let renderSeries = SCIFastColumnRenderableSeries()
        renderSeries.dataSeries = series
        sciChartSurface.renderableSeries.add(renderSeries)
    }
}



struct TestData {
    var x: Int32
    var y: Int32

    static let testData = [TestData(x: 2017, y: 5),
                           TestData(x: 2018, y: 8),
                           TestData(x: 2019, y: 2),
                           TestData(x: 2020, y: 9)]
}
0 votes
3k views

Is the styleFor function of SCIPaletteProvider that was in Version 2.0 not implemented in Version 4.8?
Also, are there any plans to implement it?

I am upgrading from SciCharts 2.0.1 to SciCharts 4.3.
When the color was set using SCI Palatt Provider in Version 2.0, the memory used was 200M, but in Version 4.3, the memory used may consume as much as 1G.
I tried to devise it by setting the Sampleing Mode, but it is not very effective.

SCI Charts is used to display the spectrum data of audio data while playing the sound.

0 votes
8k views

I was testing my charts on a simulator and when I naved away and then back to the chart screen the Simulator’s chart was totally black screen; I could move the mouse over the points and the popouts would occur; and your license notice showed in the center of the chart. So it was almost like it thought all the drawing for the chart itself needed to be black on black.

It was always broken on the 2nd or later chart. Restarting the app fixed it. I tried removing all custom settings, and calling the invalidate; and nothing caused it to redraw correctly… Fortunately, when deploying to real devices everything worked correctly. Is this an expected side effect of testing on a simulator, or is their something that I can do to force a hard refresh of the chart…

FYI: The additional debug diagnostics don’t seem to do anything on a simulator, or at least I couldn’t find anywhere it was logged.

0 votes
17k views

Hi,

I’m trying to achieve the looks of DateTimeCategory XAxis as shown on uploaded screenshot.

Formatting a single row of tick labels is not a hard task (setTextFormatting). The problem arises when there are 2 rows with same frequency (days of the week and dates) and third row with lower frequency (years).

I tried using new line character in text formatting property to break the line for days and dates and it didn’t work. I also tried having two axes bound to the same data series, each one having different formatting and majorDelta, but it seems that they don’t stack up (only first one added is shown).

Any ideas?

  • Igor Peric asked 7 years ago
  • last active 7 years ago
0 votes
4k views

I’m getting the following crash:

2020-02-14 16:45:43.902812-0500 CommonStock Development[2425:710225] -[SCIRolloverModifier onTouchesCancelled:]: unrecognized selector sent to instance 0x282ffe080
2020-02-14 16:45:43.904098-0500 CommonStock Development[2425:710225] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[SCIRolloverModifier onTouchesCancelled:]: unrecognized selector sent to instance 0x282ffe080’

whenever I try to scrub my chart, I must also note that in order for the legend to show, I have to tap really hard on the surface.

This is my code:

func set(data set: SimpleChartDataSet, alternate: SimpleChartDataSet) {

    let lineDataSeries = SCIXyDataSeries(xType: .double, yType: .double)
    let dashedDataSeries = SCIXyDataSeries(xType: .double, yType: .double)

    let group = DispatchGroup()
    group.enter()

    DispatchQueue.global(qos: .userInteractive).async {
        for (index, i) in set.enumerated() {
            lineDataSeries.append(x: Double(index), y: Double(i))
        }

        for (index, i) in alternate.enumerated() {
            dashedDataSeries.append(x: Double(index), y: Double(i))
        }

        group.leave()
    }

    group.notify(queue: .main) {

        let lineSeries = SCIFastMountainRenderableSeries()
        lineSeries.zeroLineY = set.min() ?? 0.0
        lineSeries.dataSeries = lineDataSeries
        lineSeries.strokeStyle = SCISolidPenStyle(color: UIColor.green, thickness: 2.0)
        lineSeries.areaStyle =  SCILinearGradientBrushStyle(start: CGPoint(x: 0, y: 1), end: CGPoint(x: 0, y: 0), start: UIColor.green, end: UIColor.clear)

        let dashedSeries = SCIFastLineRenderableSeries()
        dashedSeries.zeroLineY = set.min() ?? 0.0
        dashedSeries.dataSeries = dashedDataSeries
        dashedSeries.strokeStyle = SCISolidPenStyle(color: UIColor.white, thickness: 2.0, strokeDashArray: [2.0,2.0,2.0,2.0])

        SCIUpdateSuspender.usingWith(self.surface) {

            self.surface.xAxes.clear()
            self.surface.yAxes.clear()
            self.surface.renderableSeries.clear()

            let xAxis = SCINumericAxis()
            xAxis.drawLabels = false
            xAxis.drawMajorBands = false
            xAxis.drawMajorGridLines = false
            xAxis.drawMinorGridLines = false
            xAxis.drawMinorTicks = false
            xAxis.drawMajorTicks = false
            xAxis.drawLabels = false

            let yAxis = SCINumericAxis()
            yAxis.drawLabels = false
            yAxis.drawMajorBands = false
            yAxis.drawMajorGridLines = false
            yAxis.drawMinorGridLines = false
            yAxis.drawMinorTicks = false
            yAxis.drawMajorTicks = false
            yAxis.drawLabels = false

            self.surface.xAxes.add(items: xAxis)
            self.surface.yAxes.add(items: yAxis)
            self.surface.renderableSeries.add(items: lineSeries, dashedSeries )
            self.surface.chartModifiers.add(SCIRolloverModifier())
        }
    }
}
0 votes
4k views

If we set ClipMode.None we can pan infinitely to the uncharted space of left and right. this is fine.
But I want to do panning infinitely only to the left side. So I set ‘clipAtMax’. This is stop panning at right. But instead of panning infinity to the left, it is stretching the left part.
Any solution ?

1 vote
3k views

Greetings! I see you have support Xamarin.iOS and Xamarin.Android, however, I’m not sure about support status: do you support .NET 7 iOS and Android?

1 vote
6k views

We’d like to customize the look of our legends. We have 4 legends displaying different data, but right now the only thing we can change is the Theme. Is there any way to customize the legend items, like add some icons, change the point marker shape and size, change the check box icon etc…

P.S.: I’m not a trial user. We have an iOS, Android and WPF licenses purchased.

Project info:
Xamarin.iOS
SciChart.iOS 2.2.2.854

0 votes
4k views

Hi,

I wanted to try the V3 beta for iOS in objective-c but I don’t know how to format the string with the new license key.

Neither this (as found here: https://www.scichart.com/beta-edition-of-scichart-mobile-sdk-v3-now-available/):

[SCIChartSurface setRuntimeLicenseKey:@""
 "{"
   "\"ActivatedBy\": null,"
   "\"Customer\": \"Anyone\","
   "\"DeveloperCount\": null,"
   "\"ExpiryDate\": \"2019-12-21\","
   "\"Features\": ["
     "\"WPF-2D\","
     "\"AND-2D\","
     "\"iOS-2D\","
     "\"WPF-3D\","
     "\"AND-3D\","
     "\"iOS-3D\""
   "],"
   "\"IsTrialLicense\": true,"
   "\"KeyCode\":" "gRPFuMCiB0otJzffhGFJO09BtH3drfoDZV5pAkQNv9hyHJsfBsCr42BHRJ/oz2ib2uEgT33IYW3fGKExB4KPUbrNOeKazYrMI8pD5OJVlDoRXuJdY97iUZU2jNHRnXN0cgpBdqcQTWgW/afd9pYwcYT5P22sklCSrtTdwcuyepiLE9Ap9B2ixMVpoB43Yj79g1/yKzgPQaAmW38hjDyByQwxCQ9R88Jt4JqQRVQUhYxj31CFoX7Upm36oP32WGbEEex4E1qHTY+KALouRnA9JQZej13V4MjwF45xuQNiUDbk3RHtyJwWEjwGS9jHh24WiTj1aOaw8PAfBmKZl2FKfKSL7Q7Nu9jtUgZdGUbpZTKYrASpoVQiVk2/+1xAA8dB/7RdsjXVVrXf1RnMg8dNXsY7gcJJ25SF4QmZwqa82Dl+PnXGq0BSvfLaSrSl8uWkimTt0D/FwvaVqvpzomORpStboVNroTAcbaBJRIOK6tZDFwBj3qQV1N470/XW3aKHckN7GrNOpS7xpZ/EM9k=,"
   "\"MachineId\": null,"
   "\"OrderId\": \"BETA trial key\","
   "\"ProductCode\": \"SC-BUNDLE-SDK-PRO\","
   "\"SerialKey\": null,"
   "\"TicketQuantity\": null"
 "}"
 ""];

or this (old format style):

  [SCIChartSurface setRuntimeLicenseKey:@""
   "<LicenseContract>"
   "<Customer>Anyone</Customer>"
   "<OrderId>BETA trial key</OrderId>"
   "<LicenseCount>1</LicenseCount>"
   "<IsTrialLicense>true</IsTrialLicense>"
   "<SupportExpires>2019-12-21</SupportExpires>"
   "<ProductCode>SC-BUNDLE-SDK-PRO</ProductCode>"
 "<DeveloperCount>null</DeveloperCount>"
 "<MachineID>null</MachineID>"
 "<SerialKey>null</SerialKey>"
"TicketQuantity>null</TicketQuantity>"
"<Features>[WPF-2D, AND-2D, iOS-2D, WPF-3D, AND-3D, iOS-3D]</Features>" "<KeyCode>gRPFuMCiB0otJzffhGFJO09BtH3drfoDZV5pAkQNv9hyHJsfBsCr42BHRJ/oz2ib2uEgT33IYW3fGKExB4KPUbrNOeKazYrMI8pD5OJVlDoRXuJdY97iUZU2jNHRnXN0cgpBdqcQTWgW/afd9pYwcYT5P22sklCSrtTdwcuyepiLE9Ap9B2ixMVpoB43Yj79g1/yKzgPQaAmW38hjDyByQwxCQ9R88Jt4JqQRVQUhYxj31CFoX7Upm36oP32WGbEEex4E1qHTY+KALouRnA9JQZej13V4MjwF45xuQNiUDbk3RHtyJwWEjwGS9jHh24WiTj1aOaw8PAfBmKZl2FKfKSL7Q7Nu9jtUgZdGUbpZTKYrASpoVQiVk2/+1xAA8dB/7RdsjXVVrXf1RnMg8dNXsY7gcJJ25SF4QmZwqa82Dl+PnXGq0BSvfLaSrSl8uWkimTt0D/FwvaVqvpzomORpStboVNroTAcbaBJRIOK6tZDFwBj3qQV1N470/XW3aKHckN7GrNOpS7xpZ/EM9k=</KeyCode>"
   "</LicenseContract>"

   ];

worked.

I always get the message “Sorry! Your license token appears to be invalid. etc.”
What’s the right way?

Best regards,

Johannes

0 votes
7k views

Hi , many of the charts provide a way to set the date on the x axis for the data series and that makes the axis match the DataSeries value defined for that axis, but for heatmap dataseries when you define xType as date the xAxis of type date is not displaying on surface, I don’t know what I’m doing wrong and there is no sample for dates on GitHub , the samples only use int , would be great if you can provide a date sample for the heatmap , thanks

0 votes
5k views

Hi,

I am using SciChart_iOS_SDK_3.0.0.5074 with Swift 5.

I want to show string type on X-axis. I am using below code snippet.

class YearsLabelProvider: SCILabelProviderBase<SCINumericAxis> {

   var xLabels: [String] = ["Test", "Test", "Test", "Test", "Test", "Test", "Test", "Test",     "Test", "Test", "Test", "Test", "Test", "Test"]

   func update(_ axis: ISCIAxisCore!) { }

   override func formatLabel(_ dataValue: ISCIComparable!) -> ISCIString! {
        let index = Int(dataValue.toDouble())
        return NSString(string: index >= 0 && index < xLabels.count ? xLabels[index] : "")
    }

    override func formatCursorLabel(_ dataValue: ISCIComparable!) -> ISCIString! {
        let index = Int(dataValue.toDouble())

        var result: String?

        if (index >= 0 && index < xLabels.count) {
            result = xLabels[index]
        }
        return NSString(string: result!)
    }
}

Application crashes while loading with the following error –

” *** Terminating app due to uncaught exception ‘Initializer not allowed Exception’, reason: ‘Parameterless initializer of Chart.YearsLabelProvider class shouldn’t be used. Please use one of the designated initializers instead'”

Kindly help us resolving this issue since this is a showstopper issue.
I would also like to know about what data SCIXyDataSeries accepts when we are working with strings.

1 vote
4k views

Trying to install SciChart using the PodSpecs-Nightly repo:

source ‘https://github.com/ABTSoftware/PodSpecs-Nightly.git’

Running pod install results in this error:

[!] Error installing SciChart
[!] /usr/bin/curl -f -L -o /var/folders/mr/0skn4y5d1t99bcvzd09g_wdr0000gn/T/d20221220-30745-gfzfrf/file.zip https://github.com/ABTSoftware/PodSpecs-Nightly/releases/download/v4.4.1-nightly.5867/SciChart_iOS_4.4.1-nightly.5867.zip --create-dirs --netrc-optional --retry 2 -A 'CocoaPods/1.11.3 cocoapods-downloader/1.6.3'
curl: (22) The requested URL returned error: 404

Notice the word “SDK” is missing from the URL above. The correct URL should be:

https://github.com/ABTSoftware/PodSpecs-Nightly/releases/download/v4.4.1-nightly.5867/SciChart_iOS_SDK_4.4.1-nightly.5867.zip

0 votes
7k views

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?

  • Igor Peric asked 7 years ago
  • last active 1 month ago
0 votes
5k views

Hello,

I would like to add a corner radius (to give rounded corners) to the SciChart rollover tooltip in iOS. I saw that there is a “tooltipCornerRadius” property in “SCITooltipModifierStyleProtocol”, but I am having trouble figuring out how to use this. Can someone point me in the right direction?

Thank you.

  • C Bolton asked 2 years ago
  • last active 2 years ago
0 votes
10k views

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?

0 votes
8k views

Hello

In the real-time line chart, I want an animation like the video(link below).
Can you be provided with animations such as a point where a point drawn in real time continues to blink?

https://drive.google.com/file/d/1tcSFNPwSR4XEZqMX_t8GK2vzV5NUQUcn/view?usp=sharing

  • Jinsu Park asked 4 years ago
  • last active 4 years ago
0 votes
6k views

The SciChartDemo compiles and runs just fine out of the box. If I change any of the .m files from “Objective-C” to “Objective-C++” and try to compile I have a linker error:

No matching function for call to ‘SCI_constructGenericType’
Expanded from macro ‘SCIGeneric’
Candidate function not viable: no known conversion from ‘const char [2]’ to ‘char *’ for 2nd argument

If I cast 2nd argument in the macro to (char *) I get the following error:

“SCI_constructGenericType(void*, char*)”
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Am I mistaken if I believe that this has to do something with C++ name mangling? More specifically: how can I use SCIGeneric(x) macro in Objective-C++ file?

Thanks.

  • Igor Peric asked 7 years ago
  • last active 7 years ago
1 vote
6k views

We are having an issue which is preventing us from upgrading to a newer version of Xamarin iOS SciChart.

With Xamarin iOS SciChart v3, the UpdateTicks method from SCINumericTickProvider cannot be overridden, because it doesn’t exist (at least not public).

In Xamarin Android SciChart v3, it works with overriding the UpdateTicks method.

In Xamarin iOS SciChart v2, it was possible to customize the ticks by overriding the method GetMajorTicksFromAxis from the class SCINumericTickProvider.

It looks like the types generation from iOS to Xamarin C# has missed to correctly export the UpdateTicks method as public overridable. (Because the docs say it should be there and it is there on Android Xamarin.)

  • Jens Stolz asked 4 years ago
  • last active 4 years ago
0 votes
7k views

When I create a SCIChartSurface programmatically, following the Quick Start guide:
https://www.scichart.com/documentation/ios/current/creating-your-first-scichart-ios-app.html#adding-scichartsurface-purely-from-code

Functionally everything works as expected, but I see a series of these messages in the log:

   [CAMetalLayer nextDrawable] returning nil because allocation failed.

I do not see these messages when the SCIChartSurface is instantiated via a storyboard.

2 votes
12k views

Hi,
I am currently trying the iOS Charting Library and want to implement a Column series with the drill-down functionality (when touching one of column points by end user). Does the charting component supports the hit-testing or selection feature to determine which point has been clicked at runtime?
Thanks!
Liza

  • liza yudup asked 8 years ago
  • last active 8 years ago
0 votes
5k views

i want to implement a custom modifier to track the users touch, similar to rollover but without displaying a view

I tried to do this by implementing SCIGestureModifier and overriding all the onTouches methods, but – no matter the user behaviour – the modifier will always receive an onTouchesCancelled event after about a second and receive no more of these events after that.

What does work is implement onPanGesture to actually track all the user’s movement but i don’t see any way of how you would receive a touch up event this way (which i do need)

Is there any fundamental misunderstanding on how this should work on my side?

-1 votes
8k views

Hello Team,

In Pie Chart with DonutSeries, the segment spacing seems to have no effect on graph.

donutSeries.segmentSpacing = 10

Thanks

0 votes
6k views

Hello everyone.
We are trying to migrate to V3 in our iOS project and we have many issues.
One of the most important is the implementation of vertically-draggable horizontal lines.
I have a nice working code for SCICharts V2 but I cannot find any similar example of how we can implement a custom modifier for moving an SCIHorizontalLineAnnotation vertically in V3.
We have done it already with the V2 but now that we have to migrate to V3 there is a huge missing part in your documentation.
Our code was using-overiding onPanGesture() in order to figure out if the modifier should handle the touching event, then we were using the touch point in order to find the closer horizontal lines and choose the closest one in order to change the vertical value depending on the touching-changing point.
The only similar example that I found in your documentation (https://www.scichart.com/example/ios-custom-modifier/) is using SCIGestureModifier which is not accesible by the V3.
I am trying to use your SCIChartModifierBase class but cannot find anywhere a similar example of what we need.
I already tried to understand how you want us to use the ” override func onEvent(_ args: SCIModifierEventArgs!) ” function of the
SCIChartModifierBase but still no luck, it is impossible to figure out without any kind of a similar example.
The reason of needing an example is that this task needs much more information like these:
1. How to decide if the modifier should handle the touch event and how it should be ignored or handled by the next modifier in the same group ?
2. How to handle the touch started, changed, cancelled events ?
3. How to say in realtime to other modifiers in the same group that we need to to handle the same event simultaneously with this custom modifier ?
4. How to say to the group of modifiers that after the first modifer is taken the touch event then the rest should not use it ?

I will paste here our current implementation that we have done for V2 and needs to be transformed to V3 in case you need more details.

An important part is how we add the modifiers on the chart and this is how we are doing it right now:
let zoom = SCIPinchZoomModifier()
zoom.direction = .xDirection
let group = SCIChartModifierCollection(collection: [CustomModifier(chart: self),
PanModifier(),
zoom])
//group.handleGestureFirstOnly = true // Not existing in V3 anymore ! How should we do it in V3 ?
chart.chartModifiers = group

I believe that this code will be really useful for many people out there even for V2 or for migrating to V3.

Swift iOs code using SCICharts V2:

class Modifier: SCIGestureModifier {
private weak var control: ChartView?
private var editingProperty: ChartView.BindableProperty?
private var calculator: SCICoordinateCalculatorProtocol?

    init(chart: ChartView?) {
        self.control = chart
    }

    override func onPanGesture(_ gesture: UIPanGestureRecognizer?, at view: UIView?) -> Bool {

        guard let chart = view as? SCIChartSurface,
            let gesture_ = gesture
            else { return super.onPanGesture(gesture, at: view) }

        let location = gesture_.location(in: chart)
        switch gesture_.state {
        case .began:
            control?.sendActions(for: .touchDown)
            editingProperty = testForDraggableLine(location: location, in: chart)
            calculator = yAxis().getCurrentCoordinateCalculator()
            if editingProperty != nil {
                // Annotations on SciChart don't have Zindex and we want current line to be on the top
                let draggableLines = control?.chart.annotations.array.compactMap { $0 as? DraggableLine }
                if let myLine = draggableLines?.first(where: { $0.bindingKeyValue == editingProperty }) {
                    control?.chart.annotations.remove(myLine)
                    control?.chart.annotations.add(myLine)
                }
                control?.isTouchingLine(isTouching: editingProperty != nil)
            }
            return editingProperty != nil
        case .changed:
            if editingProperty != nil {
                handleDraggingLines(location: location, in: chart)
                return true
            }
        case UIGestureRecognizer.State.ended:
            if editingProperty != nil {
                control?.sendActions(for: .editingDidEnd)
                editingProperty = nil
                _ = control?.adjustYRange(force: true)
                control?.sendActions(for: .valueChanged)
                control?.refreshPositions()
                control?.isNotTouchingLine()
                return true
            }
        case UIGestureRecognizer.State.cancelled:
            if editingProperty != nil {
                control?.sendActions(for: .editingDidEnd)
                editingProperty = nil
                _ = control?.adjustYRange(force: true)
                control?.sendActions(for: .valueChanged)
                control?.refreshPositions()
                control?.isNotTouchingLine()
                return true
            }
        default:
            break
        }

        return false
    }

    private func handleDraggingLines(location: CGPoint, in chart: SCIChartSurface) {
        guard let renderSurface = chart.renderSurface,
            let yCalculator = self.calculator,
            let editingProperty = editingProperty else { return }

        let pointInChart = renderSurface.point(inChartFrame: location)
        let valueForYAxis = yCalculator.getDataValue(from: Double(pointInChart.y))
        control?.setValue(Decimal(valueForYAxis), forKey: editingProperty.rawValue)
    }

    // SOS: Filter possible properties that can be returned. We want to always avoid return - and then - dragging the current price bid or ask !
    private func testForDraggableLine(location: CGPoint, in chart: SCIChartSurface) -> ChartView.BindableProperty? {
        let hitTestDistance: Double = 30 // Pixels !
        let nearItems = chart.annotations.array
            .compactMap { $0 as? DraggableLine }
            .filter { item in
                return item.bindingKeyValue != ChartView.BindableProperty.ask &&
                    item.bindingKeyValue != ChartView.BindableProperty.bid &&
                    !item.isHidden &&
                    item.yDistance(from: location) <= hitTestDistance
            }
        return nearItems
            .sorted { $0.yDistance(from: location) < $1.yDistance(from: location) }
            .first?.bindingKeyValue
    }
}
  • Dxat asked 4 years ago
  • last active 3 years ago
1 vote
8k views

Hello!

Great work, thanks a lot for this framework!

Could you provide an example of animated inserting of a new point? My goal is to implement interpolation between previous retrieved and last point on the real-time line chart.

0 votes
10k views

I have just learned how to use sci-chart framework with tutorials.
And I tried to add values from bluetooth as realtime chart as shown in tutorials.
I have finished receiving data from a Bluetooth connection.
However, using scichart to represent this data in real time is hard to solve by looking at the tutorial alone.
Does anyone have any idea how to use real-time tutorials to teach you how to represent your own data, not the example sine graph?

The code below is what I tried and is wrong.

import UIKit
import CoreBluetooth
import SciChart

let maestroServiceCBUUID = CBUUID(string:”495sdfd3-FE7D-4AE5-8FA9-9FAFD205E455″)
let maestroBrainDataCBUUID = CBUUID(string: “4953sdf3-1E4D-4BD9-BA61-23C647249616”)
class HRMViewController: UIViewController {
var sciChartSurface: SCIChartSurface?

var lineDataSeries: SCIXyDataSeries!
var scatterDataSeries: SCIXyDataSeries!

var lineRenderableSeries: SCIFastLineRenderableSeries!
var scatterRenderableSeries: SCIXyScatterRenderableSeries!

var timer: Timer?
var phase = 0.0
var i = 0

@IBOutlet weak var brainRateLabel: UILabel!

var centralManager: CBCentralManager!
var maestroPeripheral:CBPeripheral!
override func viewDidLoad() {
super.viewDidLoad()

sciChartSurface = SCIChartSurface(frame: self.view.bounds)
sciChartSurface?.autoresizingMask = [.flexibleHeight, .flexibleWidth]
sciChartSurface?.translatesAutoresizingMaskIntoConstraints = true

self.view.addSubview(sciChartSurface!)


let xAxis = SCINumericAxis()
xAxis.growBy = SCIDoubleRange(min: SCIGeneric(0.1), max: SCIGeneric(0.1))
sciChartSurface?.xAxes.add(xAxis)

let yAxis = SCINumericAxis()
yAxis.growBy = SCIDoubleRange(min: SCIGeneric(0.1), max: SCIGeneric(0.1))
sciChartSurface?.yAxes.add(yAxis)

createRenderableSeries()
addModifiers()


centralManager = CBCentralManager(delegate: self , queue: nil)

// Make the digits monospaces to avoid shifting when the numbers change

}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

if nil == timer{
  timer = Timer.scheduledTimer(withTimeInterval: 0.01, repeats: true, block: updatingDataPoints)
}

}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)

if nil != timer{
  timer?.invalidate()
  timer = nil
}

}

func updatingDataPoints(timer:Timer){

i += 1

lineDataSeries.appendX(SCIGeneric(i), y: SCIGeneric(cos(Double(i)*0.1 + phase)))
scatterDataSeries.appendX(SCIGeneric(i), y: SCIGeneric(cos(Double(i)*0.1 + phase)))

phase += 0.01

sciChartSurface?.zoomExtents()
sciChartSurface?.invalidateElement()

}

func createDataSeries(_brainwave2:Double){
// Init line data series
lineDataSeries = SCIXyDataSeries(xType: .double, yType: .double)
lineDataSeries.fifoCapacity = 500
lineDataSeries.seriesName = “line series”

// Init scatter data series

// scatterDataSeries = SCIXyDataSeries(xType: .double, yType: .double)
// scatterDataSeries.fifoCapacity = 500
// scatterDataSeries.seriesName = “scatter series”

for i in 0...500{
  lineDataSeries.appendX(SCIGeneric(i), y: SCIGeneric(_brainwave2))

// scatterDataSeries.appendX(SCIGeneric(i), y: SCIGeneric(cos(Double(i)*0.1)))
}

i = Int(lineDataSeries.count())

}

func createRenderableSeries(){
lineRenderableSeries = SCIFastLineRenderableSeries()
lineRenderableSeries.dataSeries = lineDataSeries

scatterRenderableSeries = SCIXyScatterRenderableSeries()
scatterRenderableSeries.dataSeries = scatterDataSeries

sciChartSurface?.renderableSeries.add(lineRenderableSeries)
sciChartSurface?.renderableSeries.add(scatterRenderableSeries)

}

func addModifiers(){
let xAxisDragmodifier = SCIXAxisDragModifier()
xAxisDragmodifier.dragMode = .pan
xAxisDragmodifier.clipModeX = .none

let yAxisDragmodifier = SCIYAxisDragModifier()
yAxisDragmodifier.dragMode = .pan

let extendZoomModifier = SCIZoomExtentsModifier()
let pinchZoomModifier = SCIPinchZoomModifier()

let rolloverModifier = SCIRolloverModifier()
let legend = SCILegendModifier()

let groupModifier = SCIChartModifierCollection(childModifiers: [xAxisDragmodifier, yAxisDragmodifier, pinchZoomModifier, extendZoomModifier, legend, rolloverModifier])

sciChartSurface?.chartModifiers = groupModifier

}

func brainwaveReceived(_ brainWave:Double){
let brainWave = brainWave * 3.3 / 65536
brainRateLabel.text = String(brainWave)
print(“brainwave: (brainWave)”)
}

}

extension HRMViewController: CBCentralManagerDelegate {
func centralManagerDidUpdateState(_ central: CBCentralManager) {
switch central.state {

case .unknown:
  print("central.state is . unknown")
case .resetting:
  print("central.state is . resetting")
case .unsupported:
  print("central.state is . unsupported")
case .unauthorized:
  print("central.state is . unauthorized")
case .poweredOff:
  print("central.state is . poweredOff")
case .poweredOn:
  print("central.state is . poweredOn")
  centralManager.scanForPeripherals(withServices:nil)
}

}

func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
print(peripheral)
if peripheral.name == “MAESTRO1” {
// maestroPeripheral = peripheral
centralManager.stopScan()
maestroPeripheral = peripheral
maestroPeripheral.delegate = self
central.connect(maestroPeripheral)
}

}
func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {
print(“Connected!”)
maestroPeripheral.discoverServices([maestroServiceCBUUID])
}
}

extension HRMViewController:CBPeripheralDelegate{
func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
guard let services = peripheral.services else {return}
for service in services {
print(service)
peripheral.discoverCharacteristics(nil, for: service)
}
}
func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
guard let characteristics = service.characteristics else {return}

for characteristic in characteristics {
  print(characteristic)
  if characteristic.properties.contains(.read){
    print("\(characteristic.uuid): properties contain .read")
  }
  if characteristic.properties.contains(.notify){
    print("\(characteristic.uuid): properties contain .notify")
    peripheral.setNotifyValue(true , for: characteristic)
  }
}

}

func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic,
error: Error?) {
switch characteristic.uuid {
case maestroBrainDataCBUUID:
let wave = Double(brainData(from: characteristic))*3.3/65536
createDataSeries(_brainwave2:wave)

  default:
  print("Unhandled Characteristic UUID: \(characteristic.uuid)")
}

}
private func brainData(from characteristic: CBCharacteristic) -> Int {
guard let characteristicData = characteristic.value else { return -1 }
let byteArray = UInt8

let firstBitValue = byteArray[0] & 0x01
if firstBitValue == 0 {
  // Heart Rate Value Format is in the 2nd byte
  return Int(byteArray[1])
} else {
  // Heart Rate Value Format is in the 2nd and 3rd bytes
  return (Int(byteArray[1]) << 8) + Int(byteArray[2])
}

}

}

0 votes
7k views

Currently we have two graph surfaces with two Y axes on each side and we need all of the Y axes to have fixed width size. Until now we were achieving that like this:
topGraphSurface.LeftAxisAreaForcedSize = 45;
topGraphSurface.RightAxisAreaForcedSize = 45;
bottomGraphSurface.LeftAxisAreaForcedSize = 45;
bottomGraphSurface.RightAxisAreaForcedSize = 45;

but since updating to the new SciChart v3 we get the error “SciChartSurface does not contain a definition for (Left)AxisAreaForcedSize”. I couldn’t find any information about this in the Migration guide, so is there a way to achieve this in the new version?

1 vote
3k views

Hello,

One thing I can’t figure out is why I don’t see the axis tooltips when using SCIRolloverModifier or SCICursorModifier? If I use xAxis.axisTitleMargins = NSEdgeInsets(top: 1000, left: 0, bottom: 10, right: 0) I can see tooltips on x axis but only until some point and from there moving the cursor to the right leads to some sort of overlay and tooltip disappears. See the photos.

Is this a bug or I’m doing something wrong?

0 votes
6k views

Hello,
I’m following along with the tutorial. I installed using the pod. I am at the end of Tutorial 3 and am getting an error. Use of unresolved Identifier ‘SciGeneric’. I can see I have the wrapper file in my project. Any Ideas what I’m doing wrong?

Thanks
Warren

1 vote
6k views

Hi SciChart team,

there is a working example that implement a Polar Chart type for iOS?
I was unable to find anything in the documentation. Only for WPF platform.
If not, there is a plan to support this kind of chart in next release of the library?

Thanks for the help.

1 vote
7k views

I’m trying to render a column chart with multiple series. I want the two series to show side-by-side. See the reference image attachment for how I want it to look.

However, when I add a second series to a surface, the two series overlap and draw over each other, such that you can ‘t see some of the column data points.

Is there a way to draw multiple series that don’t overlap?

While I’m here, a have a couple of more questions:

• Is there a way to show more of the values on the time/date series X-axis . Notice in the SciChart column chart that is attached it shows every third value on the X-axis (Jan, April, July, October). It would be great if I could show every two, or all for each data point.

• For a time/date series X-axis, can I show a different representation of the time/date values? Specifically, I want to show, e.g.

Jan 17

rather than

01-2017

Presumably one would specify a different date formatter but I only see how to do variations of “MM-dd-yyy”. I want to show values as textual rather than numeric.

• Is there a way to extend the Y-axis to go higher?
In the SciChart column chart attachment, the Y-axis goes up to 100, but the values go higher. I would like to show the the Y-axis going up to 120.

• Is there a way to change the interval of the Y-axis?
Instead of showing every 20 values, can I show every 25 values?

Thanks.

  • doughill asked 7 years ago
  • last active 7 years ago
Showing 1 - 50 of 280 results

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies