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.
Digital Line Chart is used to represent a sequence of discrete values, and often is a part of applications used in digital electronics, signal processing, communications etc. This example shows how to generate the Android Digital (step) Line Chart in code. In SciChart it is done by calling setIsDigitalLine(true) method on an instance of FastLineRenderableSeries class. Digital line series can be used to render an XyDataSeries, XyyDataSeries (renders Y values), XyzDataSeries, HlcDataSeries and OhlcDataSeries(renders Close values).
Tip!
You can be very flexible and change the Line appearance by far:
– Changing its’ color and thickness with setStrokeStyle(PenStyle) methods of FastLineRenderableSeries
– Make it dashed or digital line (step line) setIsVisible(), setIsDigitalLine() methods of FastLineRenderableSeries.
– Customize by adding either predefined or custom data-point markers on a line series using the PointMarker API.
Please note that custom data-point markers will be same very performant as the same bitmap rendering as in our Scatter-Charts is used.
The full source code for the Android Digital Line Chart 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
//
// DigitalLineChartFragment.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 android.view.animation.DecelerateInterpolator
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.scichartExtensions.*
class DigitalLineChartFragment : ExampleSingleChartBaseFragment() {
override fun initExample(surface: SciChartSurface) {
val fourierSeries = DataManager.getInstance().getFourierSeries(1.0, 0.1, 5000)
surface.suspendUpdates {
xAxes { numericAxis {
growBy = DoubleRange(0.1, 0.1)
visibleRange = DoubleRange(1.0, 1.25)
}}
yAxes { numericAxis {
growBy = DoubleRange(0.5, 0.5)
visibleRange = DoubleRange(2.3, 3.3)
}}
renderableSeries {
fastLineRenderableSeries {
setIsDigitalLine(true)
xyDataSeries<Double, Double> {
append(fourierSeries.xValues, fourierSeries.yValues)
}
strokeStyle = SolidPenStyle(0xFF99EE99)
waveAnimation { interpolator = DecelerateInterpolator() }
}
}
chartModifiers { defaultModifiers() }
}
}
}
//******************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2021. All rights reserved.
//
// Web: http://www.scichart.com
// Support: support@scichart.com
// Sales: sales@scichart.com
//
// DigitalLineChartFragment.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 android.view.animation.DecelerateInterpolator;
import androidx.annotation.NonNull;
import com.scichart.charting.model.dataSeries.XyDataSeries;
import com.scichart.charting.visuals.SciChartSurface;
import com.scichart.charting.visuals.axes.IAxis;
import com.scichart.charting.visuals.renderableSeries.FastLineRenderableSeries;
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 java.util.Collections;
public class DigitalLineChartFragment extends ExampleSingleChartBaseFragment {
@Override
protected void initExample(@NonNull SciChartSurface surface) {
final IAxis xAxis = sciChartBuilder.newNumericAxis().withGrowBy(0.1, 0.1).withVisibleRange(1, 1.25).build();
final IAxis yAxis = sciChartBuilder.newNumericAxis().withGrowBy(0.5, 0.5).withVisibleRange(2.3, 3.3).build();
final DoubleSeries fourierSeries = DataManager.getInstance().getFourierSeries(1.0, 0.1, 5000);
final XyDataSeries<Double, Double> dataSeries = sciChartBuilder.newXyDataSeries(Double.class, Double.class).build();
dataSeries.append(fourierSeries.xValues, fourierSeries.yValues);
final FastLineRenderableSeries rSeries = sciChartBuilder.newLineSeries()
.withDataSeries(dataSeries)
.withStrokeStyle(0xFF99EE99, 1f, true)
.withIsDigitalLine(true)
.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).withWaveTransformation().withInterpolator(new DecelerateInterpolator()).withDuration(3000).withStartDelay(350).start();
});
}
}