Pre loader

ArrayIndexOutOfBoundsException when using LogarithmicNumericAxis and CategoryDateAxis

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
1

I’m seeing the following exception:

E/Exception: null
    java.lang.ArrayIndexOutOfBoundsException: length=0; index=-1
        at com.scichart.core.model.DoubleValues.get(SourceFile:167)
        at com.scichart.charting.numerics.tickProviders.LogarithmicNumericTickProvider.updateTicks(SourceFile:94)
        at com.scichart.charting.numerics.tickProviders.TickProvider.update(SourceFile:59)
        at com.scichart.charting.numerics.tickProviders.DeltaTickProvider.update(SourceFile:81)
        at com.scichart.charting.visuals.axes.AxisBase.onUpdateMeasure(SourceFile:957)
        at com.scichart.charting.visuals.axes.AxisBase.updateAxisMeasurements(SourceFile:936)
        at com.scichart.charting.layoutManagers.RightAlignmentOuterAxisLayoutStrategy.measureAxes(SourceFile:39)
        at com.scichart.charting.layoutManagers.DefaultLayoutManager.onLayoutChart(SourceFile:235)
        at com.scichart.charting.visuals.rendering.RenderSurfaceRenderer.a(SourceFile:207)
        at com.scichart.charting.visuals.rendering.RenderSurfaceRenderer.a(SourceFile:132)
        at com.scichart.charting.visuals.rendering.RenderSurfaceRenderer.onDraw(SourceFile:123)
        at com.scichart.drawing.opengl.RenderSurfaceGL$a.onDraw(SourceFile:234)
        at com.scichart.drawing.opengl.MyGLRenderer.b(SourceFile:299)
        at com.scichart.drawing.opengl.MyGLRenderer.onDrawFrame(SourceFile:283)
        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1571)
        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270)

I’m initializing my chart as follows:

SciChartBuilder.init(context)
builder = SciChartBuilder.instance()

...

val xAxis = builder.newCategoryDateAxis()
                            .withGrowBy(0.0, 0.05)
                            .withAxisAlignment(AxisAlignment.Bottom)
                            .withVisibleRange(sharedXRange)
                            .withDrawMinorGridLines(true)
                            .withDrawMajorGridLines(true)
                            .build()
val yAxis = builder.newLogarithmicNumericAxis()
                            .withTextFormatting("#.#E+0")
                            .withScientificNotation(ScientificNotation.LogarithmicBase)
                            .withLogarithmicBase(2.0)
                            .build()
val seriesData = builder.newXyDataSeries(Date::class.java, Double::class.javaObjectType)
                            .withSeriesName("Series A")
                            .build()
seriesData.append(data.dateData, data.yData)
series = builder.newLineSeries()
                            .withDataSeries(seriesData)
                            .build()

UpdateSuspender.using(surface) {
                Collections.addAll(surface.xAxes, xAxis)
                Collections.addAll(surface.yAxes, yAxis)
                Collections.addAll(surface.renderableSeries, series)
}

data object has about 300 valid data points.

Any ideas what’s going on? I tried running this on a new activity. If I swap LogarithmicNumericAxis for a NumericAxis, everything works fine. I looked at the decompiled .class file where the crash was occurring (I don’t have the source for SciChart), and it seems like the crash occurs when major ticks fail to get generated (majorTicks.size == 0). I tried disabling all minor/major ticks but no joy.

for(int var22 = majorTicks.size(); var22 >= 0; --var22) {
            double var23 = var4.fromExponent(var11);
            double var25 = var22 < majorTicks.size() ? majorTicks.get(var22) : majorTicks.get(var22 - 1) * var23;
Version
2.2.0.2324
  • You must to post comments
1
0

Hi Mike,

Thanks for reporting this bug. I’ve created a task in our bug tracker to investigate and fix it.

Best regards,
Yura

  • You must to post comments
0
0

This looks to be a bug with the delta provider when the number ranges are not very large.

How can we override the delta provider on Android? The doc mentions how to do this on WPF.

  • You must to post comments
0
0

Ran into this bug as well when using LogarithmicNumericAxis: https://www.scichart.com/questions/question/bug-when-using-logarithmicnumericaxis-y-axis-with-fastmountainrenderableseries-x-axis-the-mountain-series-displays-as-a-line-series

Unfortunately given the issues with LogarithmicNumericAxis, I found it easier just to implement it myself by taking the log of the points, and overriding the axis label providers.

  • You must to post comments
Showing 3 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