Comments (20)
@makedonsky94 Please have a look at the cash log below
Caused by: java.lang.IllegalStateException: Error: Value is null
at jsCode.ensureNotNull(file:///android_asset/com/tradingview/lightweightcharts/scripts/app/main.js:299)
at jsCode.TimeScale._private__doFixLeftEdge(file:///android_asset/com/tradingview/lightweightcharts/scripts/app/main.js:3509)
at jsCode.TimeScale._internal_setBaseIndex(file:///android_asset/com/tradingview/lightweightcharts/scripts/app/main.js:3165)
at jsCode.ChartModel._internal_updateTimeScale(file:///android_asset/com/tradingview/lightweightcharts/scripts/app/main.js:7102)
at jsCode.ChartApi._private__sendUpdateToChart(file:///android_asset/com/tradingview/lightweightcharts/scripts/app/main.js:10936)
at jsCode.ChartApi._internal_applyNewData(file:///android_asset/com/tradingview/lightweightcharts/scripts/app/main.js:10898)
at jsCode.SeriesApi.setData(file:///android_asset/com/tradingview/lightweightcharts/scripts/app/main.js:10329)
at jsCode.SeriesFunctionManager.findSeries(file:///android_asset/com/tradingview/lightweightcharts/scripts/app/main.js:11349)
at jsCode.Object.functionRef(file:///android_asset/com/tradingview/lightweightcharts/scripts/app/main.js:11251)
from lightweight-charts-android.
@makedonsky94 can you please take a look?
from lightweight-charts-android.
@makedonsky94 - Any ETA for this. Its very bad user experience
from lightweight-charts-android.
@makedonsky94 Please have a look at the line number in the below screenshot where the crash is happening.
from lightweight-charts-android.
Hi! We are working on this. At the moment we could not say what causing the crash. It would be helpful if you provide more details on your case
from lightweight-charts-android.
Hi we are facing this crash onSeriesCreated on the below code
api.setData(data.list.map { it as LineData })
from lightweight-charts-android.
Do you have logs for that crash? I mean can you determine what happening in the code before the crash? Do you recreate the series and then set the data? Or is it happening right after the initialization of chart?
from lightweight-charts-android.
@makedonsky94 Please have a look at the cash log as below
java.lang.IllegalStateException: Value is null
at com.tradingview.lightweightcharts.runtime.controller.WebMessageController.onMessage(WebMessageController.kt:124)
at com.tradingview.lightweightcharts.runtime.WebMessageChannel$1.onMessage(WebMessageChannel.kt:26)
at androidx.webkit.internal.WebMessagePortImpl$1.onMessage(WebMessagePortImpl.java:111)
at nk.a(chromium-Monochrome.aab-stable-410410173:3)
at hR2.handleMessage(chromium-Monochrome.aab-stable-410410173:6)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6762)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.IllegalStateException
at dalvik.system.VMStack.getThreadStackTrace(Native Method)
at java.lang.Thread.getStackTrace(Thread.java:1538)
at com.tradingview.lightweightcharts.runtime.controller.WebMessageController.callBridgeFunction(WebMessageController.kt:56)
at com.tradingview.lightweightcharts.runtime.controller.WebMessageController.callBridgeFunction$default(WebMessageController.kt:48)
at com.tradingview.lightweightcharts.runtime.controller.WebMessageController.callFunction(WebMessageController.kt:22)
at com.tradingview.lightweightcharts.api.delegates.SeriesApiDelegate.setData(SeriesApiDelegate.kt:37)
at com.moneycontrol.handheld.fragments.StockDetailRevampFragment$createSeriesWithData$2.invoke(StockDetailRevampFragment.kt:2462)
at com.moneycontrol.handheld.fragments.StockDetailRevampFragment$createSeriesWithData$2.invoke(StockDetailRevampFragment.kt:111)
at com.tradingview.lightweightcharts.api.delegates.ChartApiDelegate$addAreaSeries$1.invoke(ChartApiDelegate.kt:71)
at com.tradingview.lightweightcharts.api.delegates.ChartApiDelegate$addAreaSeries$1.invoke(ChartApiDelegate.kt:26)
at com.tradingview.lightweightcharts.runtime.controller.WebMessageController$BufferElement.invoke(WebMessageController.kt:155)
at com.tradingview.lightweightcharts.runtime.controller.WebMessageController.onMessage(WebMessageController.kt:104)
at com.tradingview.lightweightcharts.runtime.WebMessageChannel$1.onMessage(WebMessageChannel.kt:26)
at androidx.webkit.internal.WebMessagePortImpl$1.onMessage(WebMessagePortImpl.java:111)
from lightweight-charts-android.
I suppose that you can send an empty date value in bar data which leads to crash.
What we can do at the moment:
- add verification of datetime input
- add stacktrace from javascript backend for better understanding of crashes.
We are working on the new version of library so you will see that changes in the nearest update.
from lightweight-charts-android.
When should we expect the update?
from lightweight-charts-android.
We expect releasing of the library this month. If you want to fix this crash right now, please consider to make your own checks for correctness of bar data
from lightweight-charts-android.
At 3.5 we've improved crash logs. I guess that will make much easier to find an issue in your code. Pleases make an update of library version in the project and send us a new crashlog
from lightweight-charts-android.
okay sure.
from lightweight-charts-android.
@supriyakhankarnw18 is there any way how we can reproduce it locally either with your app? The error is really strange and I'm just wonder how it might happen.
from lightweight-charts-android.
@timocov there is one scenario our QA found while performing stress testing where we are getting the same crash, so here the crash occurs.
We are attaching the video reference for the same, please look into it.
LightWeighChartCrash2.mp4
lightweightchartcharh1.mp4
We are sure that this kind of scenario may not be performed at the user level, but we are able to get a similar crash from the users in Crashylatics logs that are unable to track/reproduce at our end.
from lightweight-charts-android.
@supriyakhankarnw18 if you can reproduce it locally somehow, is it possible to log all actions you do with lightweight-charts so we can try to reproduce them locally by using your steps? I mean, you can log every API call with all arguments so we can replicate all steps ourselves
from lightweight-charts-android.
@timocov after every API call we are calling this below method to set the data and load the chart
private fun createSeriesWithData(
data: Data,
priceScale: PriceScaleId,
chartApi: ChartApi,
onSeriesCreated: (SeriesApi) -> Unit) {
try {
when (data.type) {
SeriesDataType.AREA -> {
if (data.direction == 1) {
chartApi.addAreaSeries(
options = AreaSeriesOptions(
lineColor = Color.argb(255, 76, 175, 80).toIntColor(),
topColor = Color.argb(143, 76, 175, 80).toIntColor(),
bottomColor = Color.argb(10, 76, 175, 80).toIntColor(),
lineWidth = LineWidth.TWO
),
onSeriesCreated = { api ->
api.setData(data.list.map { it as LineData })
chartApi.timeScale.fitContent()
val options = PriceLineOptions(
lineWidth = LineWidth.TWO,
lineStyle = LineStyle.SOLID,
axisLabelVisible = true
)
onSeriesCreated(api)
}
)
} else {
chartApi.addAreaSeries(
options = AreaSeriesOptions(
priceScaleId = priceScale,
lineColor = Color.rgb(227, 81, 90).toIntColor(),
topColor = Color.argb(143, 227, 81, 90).toIntColor(),
bottomColor = Color.argb(10, 227, 81, 90).toIntColor(),
lineWidth = LineWidth.TWO
),
onSeriesCreated = { api ->
api.setData(data.list.map { it as LineData })
chartApi.timeScale.fitContent()
val options = PriceLineOptions(
lineWidth = LineWidth.ONE,
lineStyle = LineStyle.SOLID,
axisLabelVisible = true
)
onSeriesCreated(api)
}
)
}
}
SeriesDataType.CANDLESTICK -> {
if (Utility.isDarkTheme(requireContext())) {
chartApi.addCandlestickSeries(
options = CandlestickSeriesOptions(
upColor = Color.parseColor("#95CD4F").toIntColor(),
borderUpColor = Color.parseColor("#95CD4F").toIntColor(),
wickUpColor = Color.parseColor("#95CD4F").toIntColor(),
downColor = Color.parseColor("#D6524F").toIntColor(),
borderDownColor = Color.parseColor("#D6524F").toIntColor(),
wickDownColor = Color.parseColor("#D6524F").toIntColor()
),
onSeriesCreated = { api ->
api.setData(data.list)
chartApi.timeScale.fitContent()
onSeriesCreated(api)
}
)
} else {
chartApi.addCandlestickSeries(
options = CandlestickSeriesOptions(
upColor = Color.parseColor("#26a69a").toIntColor(),
borderUpColor = Color.parseColor("#26a69a").toIntColor(),
wickUpColor = Color.parseColor("#26a69a").toIntColor(),
downColor = Color.parseColor("#ef5350").toIntColor(),
borderDownColor = Color.parseColor("#ef5350").toIntColor(),
wickDownColor = Color.parseColor("#ef5350").toIntColor()
),
onSeriesCreated = { api ->
api.setData(data.list)
chartApi.timeScale.fitContent()
onSeriesCreated(api)
}
)
}
}
}
} catch (e: Exception) {
e.printStackTrace()
}
}
have shared the line on which we are getting crash
It seems like a Threading issue inside the library
from lightweight-charts-android.
I'm just curious what can you do (even in multi-threaded/async environment) with lightweight-charts so it will fail like this. The error you shown in #51 (comment) is really strange and looking in the code of lightweight-charts I cannot even image the case why it might happen (let's say you have an array, and you just checked whether it is empty or not, and after that you take the first element but it doesn't exist).
from lightweight-charts-android.
@timocov These are some more logs from Crashlytics
from lightweight-charts-android.
Ok, it seems that I figured out why this happened. For some reason the size of the container for lightweight-charts is 0x0 what leads for this error. We'll fix it from our side, but as workaround you can always provide positive size of the chart by providing the size explicitly via options.
Please track tradingview/lightweight-charts#821 for the fix. I'm going to close this issue.
from lightweight-charts-android.
Related Issues (20)
- Error: Cannot update oldest data, last time=1658933400, new time=1658899800 HOT 1
- simple Example is needded
- Add the ability to control the size of markers
- The `ChartApiDelegate` `removeSeries` method's `onSeriesDeleted` callback is not called
- Migration to v4.0 library HOT 1
- Chart does not allow to set interval lower 1 Day
- Chart is Overwritting with new Data. how to clear existing data and recreate new chart? HOT 2
- How can i draw a straight vertical line on tradingview chart library
- Noise errors
- How to set visible range HOT 1
- Please Check this
- Do we support K-line indicators, such as MA EMA BOLL and so on
- not dispaly data HOT 1
- Compose. The markers not drawing after the view is recreated. HOT 2
- Alerts, Indicators, Drawings HOT 1
- Compose: ChartView blinks with white color
- LightweightChart Integration Exception in Android App (3.7.0)
- Does This support live data
- Time in milliseconds
- IllegalStateException data must be asc ordered by time
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lightweight-charts-android.