Pre loader

Tooltip fail to disappear when we move the cursor fast while the chart object is in a scrollable view

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
0

We have a sciChart surface in a fragment that has a scrollable view. We enabled tooltips using custom cursor modifier on the sci chart to show the values as the selection (touching a point in the chart object).

When we are moving the selection on x-axis tooltip sometimes it works fine and disappears when the selection is taken out. But sometimes it get freezed. At the same time, if we touch and move the selection in a vertical axis, tooltip box gets stuck and does not disappear even when the selection is taken out.

Tried so far:
We tried to replicate the issue in landscape mode and it works fine.
If we make the chart object to the whole page view, tool tips appears and disappears as expected.
But when the same used in portrait mode as a part of fragment (50% of screen) , problem arises

Steps to reproduce:
Have a chart object in a scrollable view.
Make sure the chart object doesnot appear on the fully screen without scrolling.
Now scroll to see the chart object.
Try to see the tooltip and move the selection in vertical axis.

Version
v4.4.0.4739
Images
  • You must to post comments
0
0

@Andrew Burnett-Thompson

Code for the above issue:

Xml file:

 

 

 

 

 

 

Activity:

package com.scichart.examples

import android.content.Context
import android.graphics.Color
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.text.SpannableStringBuilder
import android.util.TypedValue
import com.scichart.charting.modifiers.CursorModifier
import com.scichart.charting.numerics.labelProviders.NumericLabelProvider
import com.scichart.charting.visuals.SciChartSurface
import com.scichart.charting.visuals.axes.AxisAlignment
import com.scichart.charting.visuals.renderableSeries.hitTest.DefaultXySeriesInfoProvider
import com.scichart.charting.visuals.renderableSeries.hitTest.XySeriesInfo
import com.scichart.charting.visuals.renderableSeries.tooltips.ISeriesTooltip
import com.scichart.charting.visuals.renderableSeries.tooltips.XySeriesTooltip
import com.scichart.core.utility.StringUtil
import com.scichart.data.model.DoubleRange
import com.scichart.drawing.utility.ColorUtil
import com.scichart.examples.data.RandomWalkGenerator
import com.scichart.examples.utils.Constant
import com.scichart.examples.utils.TextLabelFormatter
import com.scichart.examples.utils.interpolator.DefaultInterpolator
import com.scichart.examples.utils.scichartExtensions.*
import kotlin.math.roundToInt

class SciActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_sci)
val surfacevalue= findViewById(R.id.surfaceArea)

val randomWalkGenerator = RandomWalkGenerator()
val data1 = randomWalkGenerator.getRandomWalkSeries(POINTS_COUNT)
randomWalkGenerator.reset()

surfacevalue.suspendUpdates {
xAxes { numericAxis() }
yAxes { numericAxis() }

renderableSeries {
fastLineRenderableSeries {
xyDataSeries<Double, Double>(“Series #1”) {
append(data1.xValues, data1.yValues)
}
strokeStyle = SolidPenStyle(0xffae418d, 2f)
seriesInfoProvider = CustomSeriesInfoProvider()

}

}

val cursorModifier = CursorModifier(R.layout.example_custom_cursor_modifier_tooltip_container).apply {
val thickness = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2f, resources.displayMetrics)
SolidPenStyle(0xAA47bde6, thickness).initPaint(crosshairPaint)
}

chartModifiers { modifier(cursorModifier) }
}
}

private class CustomSeriesInfoProvider : DefaultXySeriesInfoProvider() {
override fun getSeriesTooltipInternal(context: Context, seriesInfo: XySeriesInfo<>?, modifierType: Class<>): ISeriesTooltip {
return when (modifierType) {
CursorModifier::class.java -> { CustomXySeriesTooltip(context, seriesInfo) }
else -> { super.getSeriesTooltipInternal(context, seriesInfo, modifierType) }
}
}

private class CustomXySeriesTooltip(context: Context?, seriesInfo: XySeriesInfo<*>?) : XySeriesTooltip(context, seriesInfo) {
init {
val displayMetrics = resources.displayMetrics
val padding = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1f, displayMetrics).roundToInt()
setPadding(padding, padding, padding, padding)
}

override fun internalUpdate(seriesInfo: XySeriesInfo<*>) {
val sb = SpannableStringBuilder()
seriesInfo.seriesName?.run {
sb.append(this).append(StringUtil.NEW_LINE)
}
sb.append(“X: “).append(seriesInfo.formattedXValue)
sb.append(” Y: “).append(seriesInfo.formattedYValue)
text = sb

setTooltipBackgroundColor(0xff4781ed.toInt())
setTooltipStroke(0xff4781ed.toInt())
setTooltipTextColor(ColorUtil.White)
}
}
}

companion object {
private const val POINTS_COUNT = 200
}

}

Drive link for Video:
https://drive.google.com/file/d/1U-Jyaw6vhaUUoR8aUm6ibltMq2aeEAyH/view?usp=drive_link

Images
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.