Hi
I have a chart from a sound.
In xiaomi phones when resume chart after pause it, my line chart faces the severe lag.
In other phones my chart work well.
what should I do?
phone is (Xiaomi mi a3)
private void resume() {
forceRunInPauseMode = true;
mediaPlayer.seekTo(currentTime);
mediaPlayer.start();
completedState = false;
pauseState = false;
updateChart();
}
private void updateChart() {
schedule = scheduledExecutorService.scheduleWithFixedDelay(() -> {
if (mediaPlayer.isPlaying() || forceRunInPauseMode){
UpdateSuspender.using(binding.sciChart, mRunnable);
}
}, 0, TIME_INTERVAL, TimeUnit.MILLISECONDS);
}
private Runnable mRunnable = new Runnable() {
@Override
public void run() {
forceRunInPauseMode = false;
currentTime = mediaPlayer.getCurrentPosition();
currentRange = currentTime * 2;
getActivity().runOnUiThread(()->binding.tvCurrentDuration.setText(MiliToTimeConverter.milliToTime(currentTime)));
if (currentRange < 0)
currentRange = 0;
else if (currentRange > xDoubleArray.length - 1)
currentRange = xDoubleArray.length - 1;
if (!drawed) {
DoubleValues xValues = new DoubleValues(Arrays.copyOfRange(xDoubleArray, 0, xDoubleArray.length-1));
DoubleValues yValues = new DoubleValues(Arrays.copyOfRange(yDoubleArray, 0, yDoubleArray.length-1));
DoubleSeries doubleSeries = new DoubleSeries(xValues, yValues);
lineData.append(doubleSeries.getxValues(), doubleSeries.getyValues());
drawed = true;
}
xVisibleRange.setMinMax((double) (currentRange - visibleInterval / 2), (double) (currentRange + visibleInterval / 2));
}
};
- abolfazl ghanbari asked 4 years ago
- last active 4 years ago
I would like a “Pause” button on my chart to temporarily suspend drawing updates, even while realtime data updates are still coming in to the databound DataSeries. Pressing the button again would re-enable drawing updates and show the data lines updated with all the data collected while drawing was previously paused.
Is there anything in the SciChart API to do this easily or would I need to do this manually (possibly by cloning the DataSeries when the chart is paused and databinding to the clones, then restoring the original binding when un-paused)?
Thanks!
- Matthew Becker asked 8 years ago
- last active 8 years ago