Hi everyone,
I’m currently working on a project where I need to plot a candlestick chart, but I’m running into some trouble with the layout. Specifically, I’m trying to display the candlestick chart in the left two-thirds of the plot, leaving the right one-third of the plot available for annotations and other elements. The issue I’m facing is that the candlesticks are still being drawn in the right third of the plot, which is something I want to avoid.
I’ve attached an example image showing how it should look.
Currently, the chart displays the end of the data, and when you horizontally scroll, the buttons on the right side get pushed further right (because they are set using custom annotations on specific x and y axes positions), and the candlestick chart starts appearing in the right section.
Is there a way to set it up so that the candlestick chart does not render in the right section, but everything else (like the annotations and buttons) still does?
Has anyone here tackled a similar problem or knows how to prevent the candlesticks from being drawn in the right third while keeping that space available for other elements? Any advice or code examples would be greatly appreciated!
Thanks in advance!
- Libor Zapletal asked 1 month ago
Hello,
I have a problem reading the position of the vertical line annotations. The function “getX1” returns type double (0 – 1) or date depending on whether the annotation has not changed its position. I found out from the documentation that the type returned depends on the coordinateMode. I set it to absolute. This change had no effect, unlike in library written in Java. Is it possible to set the default type? Can I ask for any guidance needed to solve the problem? The version of the library I am using is 4.4.2.5871.
Thanks in advance!
Paweł
- Paweł Panasiuk asked 5 months ago
SplineLineRenderableSeries doesn’t render curved graph line properly in Swift , it renders stepped line for the data series .For reference please check the Screenshot attached ,ECG line(Green) rendered as stepped line (Marked by rectangle). Let me know anything I need to update in my code
Please find below the code for initialisation go the graph and updating the graph same. I am updating graph realtime with same DataSeries.
-
Graph initialisation code
func init_ECG_Chart()
{
//Remove Theme From Chart By Apply & Remove & Change Border color
SCIThemeManager.applyTheme(to: self.ecg_Chart_Surface, withThemeKey: SCIChart_Bright_SparkStyleKey)
SCIThemeManager.removeTheme(byThemeKey: SCIChart_Bright_SparkStyleKey)self.ecg_Chart_Surface.isOpaque = false self.ecg_Chart_Surface.backgroundColor = .clear self.ecg_Chart_Surface.renderableSeriesAreaBorderStyle = SCISolidPenStyle(color: .clear, thickness: 0) //Line let lineSeries = SCISplineLineRenderableSeries() lineSeries.strokeStyle = SCISolidPenStyle(color: ecgSelectedColor, thickness: 2.0) lineSeries.dataSeries = ecgLineDataSeries
// lineSeries.resamplingMode = SCIResamplingMode_None //Resampling off
// lineSeries.resamplingMode = SCIResamplingMode_Auto //Resampling offlet xAxis = SCINumericAxis() xAxis.axisAlignment = .bottom xAxis.drawLabels = false xAxis.drawMajorGridLines = false xAxis.drawMinorGridLines = false xAxis.drawMajorTicks = false xAxis.drawMinorTicks = false let yAxis = SCINumericAxis() yAxis.axisAlignment = .left yAxis.drawLabels = false yAxis.drawMajorGridLines = false yAxis.drawMinorGridLines = false yAxis.drawMajorTicks = false yAxis.drawMinorTicks = false yAxis.autoRange = .never //Stop auto ranging axis yAxis.visibleRange = SCIDoubleRange(min: -32, max: 96)
// yAxis.visibleRangeLimit = SCIDoubleRange(min: -32, max: 96)
yAxis.growBy = SCIDoubleRange(min: 0.2, max: 0.2) SCIUpdateSuspender.usingWith(self.ecg_Chart_Surface) { self.ecg_Chart_Surface.xAxes.add(items: xAxis) self.ecg_Chart_Surface.yAxes.add(items: yAxis) self.ecg_Chart_Surface.renderableSeries.add(items: lineSeries) //self.ecg_Chart_Surface.chartModifiers.add(items: SCIZoomExtentsModifier(),SCIPinchZoomModifier()) }
} //Init ECG
-
Graph updation code
func update_ECG_Chart(xValues:SCIDoubleValues,yValues:SCIDoubleValues)
{SCIUpdateSuspender.usingWith(self.ecg_Chart_Surface) { self.ecgLineDataSeries.append(x: xValues, y: yValues) // self.ecg_Chart_Surface.zoomExtents() self.ecg_Chart_Surface.zoomExtentsX() }
} //Update ECG
- djkaran nasa asked 3 years ago
- last active 3 years ago
Try to integrate new SciChart.xcframework 4.2.0 instead of SciChart.framework 2.0 to the project and build failed in Xcode 12.4 with the next errors:
RNSciCandlestickChart.swift:
1) 335th line: Editor placeholder in source file
dates.add(date!))
2) 549th line: Cannot convert value of type ‘Bundle.Type’ to expected argument type ‘Bundle’ SCIThemeManager.addTheme(byThemeKey: theme, from: Bundle)
3) 768th line: Method does not override any method from its superclass
override func internalHandleGesture(_ gestureRecognizer: UIGestureRecognizer)
AnnotationDragListener.swift:
1) 4th line: Cannot find type ‘SCIAnnotationDragListener’ in scope
class AnnotationDragListener: SCIAnnotationDragListener
RNSciLineChart.swift:
1) 475th line: Editor placeholder in source file
SCIThemeManager.addTheme(byThemeKey: theme, from: Bundle)
Can you tell me please can I launch SciChart.xcframework 4.2.0 in Xcode 12.4? Any how to solve this issues?
- Alexander Kishchak asked 4 years ago
- last active 3 years ago
Hi,
I’m trying to convert Java code to swift and I need the AnnotationLabel’s setAxisLabelStyle equivalent.
AnnotationLabel annotationLabel = new AnnotationLabel(getContext());
annotationLabel.setLabelPlacement(LabelPlacement.Axis);
annotationLabel.setAxisLabelStyle(new Action1<AnnotationLabel>()
{
@Override
public void execute(AnnotationLabel annotationLabel)
{
annotationLabel.setFontStyle(new FontStyle(37.0f, Color.BLUE));
annotationLabel.setBackgroundResource(R.drawable.current_price);
}
});
How can i apply this code in swift?
- Emre Gökberk asked 4 years ago
- last active 4 years ago
Hi,
I’m trying to convert Java code to swift and I need the RolloverModifier class’s updateCurrentPoint method. I create CustomRolloverModifier class inherits from SCIRolloverModifier class and import SciChart.Protected.SCIRolloverModifier extension too. But i can’t find updateCurrentPoint method. What is the updateCurrentPoint equivalent method on swift?
Thanks.
- Emre Gökberk asked 4 years ago
- last active 4 years ago
Hi,
How can i listen annotation selection changes? I try this code but i’m getting error “Cannot assign to property: ‘lineAnnotation’ is immutable”
var lineAnnotation = SCILineAnnotation()
lineAnnotation.annotationSelectionChangedListener = { (annotation, isSelected) in
//
}
Tnx.
- apiftechnics api asked 4 years ago
- last active 4 years ago
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.
- apiftechnics api asked 4 years ago
- last active 4 years ago
Hello,
I’m trying to convert Android (Java) code to iOS (Swift), and I need to create a custom SCIZoomPanModifier. In the android code, onFling, onDown, and onDown were overridden, but I can’t seem to do that in iOS. How can I override onFling, onDown, and onUp in iOS to mimic the android code?
Thanks
- Yatharth Chhabra asked 4 years ago
- last active 4 years ago
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….
- Nathanael Anderson asked 5 years ago
- last active 5 years ago
I would like to add scrollBar to SCINumericAxis for example xAxis.
I did find documentation:
https://www.scichart.com/documentation/v5.x/webframe.html#Scrollbars.html
But on iOS version, I can’t find numericAxis.Scrollbar is missing
- Andrii Trotsko asked 5 years ago
- last active 5 years ago
Hi,
I am using sci chart version 2.2.1.2256 in that I am getting date wrong, I have attached image please go through it.Here I am sending previously how I am getting date and now what I am getting.
I am using date formatter “dd/MM/yyyy”
finalDateStr = “29/08/2016” and finalWeightStr = “76.7”
dataSeries.appendX(SCIGeneric(dateFormatt.date(from: finalDateStr)!), y: SCIGeneric(finalWeightStr))
- NanoHealth IT asked 6 years ago
- last active 6 years ago
Working on building a candlestick chart in Swift. I have a working chart following the example. I get zoom and pan fine. But am getting an error when I swipe left on the chart. Can’t quite figure out what I’m missing. Seems like my data is unsorted but I don’t see any documentation on how it should be sorted and glad to send the repo if you like…
Thanks much – Warren
2017-09-14 14:31:39.426976-0700 GoogleStockAPI[7040:2331198] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unsorted data occurs in the collection. The only allowed SearchMode is SCIArraySearchMode_Exact'
*** First throw call stack:
(0x18a2c6fe0 0x188d28538 0x1013c9644 0x101422af0 0x1013fbdb0 0x101421b28 0x1013fb7c8 0x101398be8 0x101399084 0x10142dd04 0x1013effd0 0x1013a22dc 0x10140a47c 0x101419f04 0x1023f44fc 0x18d4d95dc 0x18d4d948c 0x18a533b9c 0x18a25d960 0x18a275ae4 0x18a275284 0x18a272d98 0x18a1a2da4 0x18bc0d074 0x19045dc9c 0x1000ceb1c 0x1891b159c)
libc++abi.dylib: terminating with uncaught exception of type NSException
I am getting my data for this chart from a live API and after I parse the JSON I populate it with this as
Date, Double, Double, Double, Double, and it looks like this –
Date OHLC: 2017-04-27 07:00:00 +0000 143.9225 144.16 143.31 143.79
Date OHLC: 2017-04-26 07:00:00 +0000 144.47 144.6 143.3762 143.68
Here is the function to render the series
fileprivate func getCandleRenderSeries(_ isReverse: Bool,
upBodyBrush: SCISolidBrushStyle,
upWickPen: SCISolidPenStyle,
downBodyBrush: SCISolidBrushStyle,
downWickPen: SCISolidPenStyle,
count: Int) -> SCIFastCandlestickRenderableSeries {
let ohlcDataSeries = SCIOhlcDataSeries(xType: .dateTime, yType: .double)
ohlcDataSeries.acceptUnsortedData = true
let items = self.dataFeed.lastPrice
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd"
for i in 0..<(items.count) - 1 {
let date:Date = dateFormatter.date(from: items[i].date!)!
ohlcDataSeries.appendX(SCIGeneric(date),
open: SCIGeneric(items[i].open!),
high: SCIGeneric(items[i].high!),
low: SCIGeneric(items[i].low!),
close: SCIGeneric(items[i].close!))
}
let candleRendereSeries = SCIFastCandlestickRenderableSeries()
candleRendereSeries.dataSeries = ohlcDataSeries
candleRendereSeries.fillUpBrushStyle = upBodyBrush
candleRendereSeries.fillDownBrushStyle = downBodyBrush
candleRendereSeries.strokeUpStyle = upWickPen
candleRendereSeries.strokeDownStyle = downWickPen
return candleRendereSeries
}
- Warren Hansen asked 7 years ago