SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
SciChart Android ships with ~90Â Android Chart Examples which you can browse, play with, view the source-code and even export each SciChart Android Chart Example to a stand-alone Android Studio project. All of this is possible with the new and improved SciChart Android Examples Suite, which ships as part of our Android Charts SDK.
The algorithms for smoothing the charts data or creating a spline series are commonly used when showing all raw data is not efficient. This might be the case when the raw dataset is so large that it does not gives meaningful insights to the pick and trends. In contrast the smoothed lines will provide a great user experience to the customers of your Android charting application. That is why we have created the Spline Line, Spline Mountain and Spline Band series for SciChart Android API.
This example demonstrates how to create a Spline Band Series for Android applications in Java using SplineBandRenderableSeries type. Spline High-Low Fill or Spline Band Series are provided by the SplineBandRenderableSeries type. This accepts data in a triplet form (X, Y1, Y2) and renders two lines with a polygon, which changes color depending on whether Y1>Y2 or vice versa. The flexible Spline Band series API allows to specify Fill, FillY1 brushes and Stroke, StrokeY1 pens. You can also add point markers onto this series.
Read more in the SciChart Android Spline Band Series documentation.
See also: Spline Mountain Series and Spline Line series.
The full source code for the Android Spline Band Series example is included below (Scroll down!).
Did you know you can also view the source code from one of the following sources as well?
//******************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2021. All rights reserved.
//
// Web: http://www.scichart.com
// Support: support@scichart.com
// Sales: sales@scichart.com
//
// SplineBandChartFragment.kt is part of SCICHART®, High Performance Scientific Charts
// For full terms and conditions of the license, see http://www.scichart.com/scichart-eula/
//
// This source code is protected by international copyright law. Unauthorized
// reproduction, reverse-engineering, or distribution of all or any portion of
// this source code is strictly prohibited.
//
// This source code contains confidential and proprietary trade secrets of
// SciChart Ltd., and should at no time be copied, transferred, sold,
// distributed or made available without express written permission.
//******************************************************************************
package com.scichart.examples.fragments.examples2d.basicChartTypes.kt
import com.scichart.charting.visuals.SciChartSurface
import com.scichart.data.model.DoubleRange
import com.scichart.examples.data.DataManager
import com.scichart.examples.fragments.base.ExampleSingleChartBaseFragment
import com.scichart.examples.utils.interpolator.ElasticOutInterpolator
import com.scichart.examples.utils.scichartExtensions.*
class SplineBandChartFragment : ExampleSingleChartBaseFragment() {
override fun initExample(surface: SciChartSurface) {
val data = DataManager.getInstance().getDampedSinewave(1.0, 0.005, 1000, 13)
val moreData = DataManager.getInstance().getDampedSinewave(1.0, 0.005, 1000, 12)
surface.suspendUpdates {
xAxes { numericAxis { growBy = DoubleRange(0.1, 0.1) }}
yAxes { numericAxis { growBy = DoubleRange(0.2, 0.2) }}
renderableSeries {
splineBandRenderableSeries {
xyyDataSeries<Double, Double> {
for (i in 0 until 10) {
val index = i * 100
append(data.xValues[index], data.yValues[index], moreData.yValues[index])
}
}
fillBrushStyle = SolidBrushStyle(0x33279B27)
fillY1BrushStyle = SolidBrushStyle(0x33FF1919)
strokeStyle = SolidPenStyle(0xFFFF1919)
strokeY1Style = SolidPenStyle(0xFF279B27)
ellipsePointMarker {
setSize(7)
strokeStyle = SolidPenStyle(0xFF006400)
fillStyle = SolidBrushStyle(0xFFFFFFFF)
}
scaleAnimation { interpolator = ElasticOutInterpolator() }
}
}
chartModifiers { defaultModifiers() }
}
}
}
//******************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2021. All rights reserved.
//
// Web: http://www.scichart.com
// Support: support@scichart.com
// Sales: sales@scichart.com
//
// SplineBandChartFragment.java is part of SCICHART®, High Performance Scientific Charts
// For full terms and conditions of the license, see http://www.scichart.com/scichart-eula/
//
// This source code is protected by international copyright law. Unauthorized
// reproduction, reverse-engineering, or distribution of all or any portion of
// this source code is strictly prohibited.
//
// This source code contains confidential and proprietary trade secrets of
// SciChart Ltd., and should at no time be copied, transferred, sold,
// distributed or made available without express written permission.
//******************************************************************************
package com.scichart.examples.fragments.examples2d.basicChartTypes;
import androidx.annotation.NonNull;
import com.scichart.charting.model.dataSeries.XyyDataSeries;
import com.scichart.charting.visuals.SciChartSurface;
import com.scichart.charting.visuals.axes.IAxis;
import com.scichart.charting.visuals.pointmarkers.EllipsePointMarker;
import com.scichart.charting.visuals.renderableSeries.SplineBandRenderableSeries;
import com.scichart.core.framework.UpdateSuspender;
import com.scichart.examples.data.DataManager;
import com.scichart.examples.data.DoubleSeries;
import com.scichart.examples.fragments.base.ExampleSingleChartBaseFragment;
import com.scichart.examples.utils.interpolator.ElasticOutInterpolator;
import java.util.Collections;
public class SplineBandChartFragment extends ExampleSingleChartBaseFragment {
@Override
protected void initExample(@NonNull SciChartSurface surface) {
final IAxis xAxis = sciChartBuilder.newNumericAxis().withGrowBy(0.1, 0.1).build();
final IAxis yAxis = sciChartBuilder.newNumericAxis().withGrowBy(0.2, 0.2).build();
final DoubleSeries data = DataManager.getInstance().getDampedSinewave(1.0, 0.005, 1000, 13);
final DoubleSeries moreData = DataManager.getInstance().getDampedSinewave(1.0, 0.005, 1000, 12);
final XyyDataSeries<Double, Double> dataSeries = sciChartBuilder.newXyyDataSeries(Double.class, Double.class).build();
for (int i = 0; i < 10; i++) {
final int index = i * 100;
dataSeries.append(data.xValues.get(index), data.yValues.get(index), moreData.yValues.get(index));
}
final SplineBandRenderableSeries rSeries = sciChartBuilder.newSplineBandSeries()
.withDataSeries(dataSeries)
.withFillColor(0x33279B27).withFillY1Color(0x33FF1919)
.withStrokeStyle(0xFFFF1919, 1f, true).withStrokeY1Style(0xFF279B27, 1f, true)
.withPointMarker(sciChartBuilder.newPointMarker(new EllipsePointMarker()).withSize(7, 7).withStroke(0xFF006400, 1).withFill(0xFFFFFFFF).build())
.build();
UpdateSuspender.using(surface, () -> {
Collections.addAll(surface.getXAxes(), xAxis);
Collections.addAll(surface.getYAxes(), yAxis);
Collections.addAll(surface.getRenderableSeries(), rSeries);
Collections.addAll(surface.getChartModifiers(), sciChartBuilder.newModifierGroupWithDefaultModifiers().build());
sciChartBuilder.newAnimator(rSeries).withScaleTransformation().withInterpolator(new ElasticOutInterpolator()).withDuration(3000).withStartDelay(350).start();
});
}
}