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.
- Krish J asked 1 year ago
-
Hi Krish, can you provide code to reproduce this issue? Please ensure when asking questions you do so according to our question asking guidelines. http://scichart.com/question-asking-guidelines/
- You must login to post comments
@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
- Krish J answered 1 year ago
- last edited 1 year ago
- You must login to post comments
Please login first to submit.