Search Results for

    Show / Hide Table of Contents

    The Impulse (Stem) Series Type

    Impulse Charts are provided by the FastImpulseRenderableSeries class and is a hybrid of Column Series and Scatter Series. It accepts data (X, Y) from a XyDataSeries<TX,TY> and draws a single line from zeroLineY to the [X, Y] value with an optional IPointMarker.

    Note

    Examples for the Impulse Series can be found in the SciChart Android Examples Suite as well as on GitHub:

    • Native Example
    • Xamarin Example

    Like the XyScatterRenderableSeries type, FastImpulseRenderableSeries requires a shape to be specified for the Point Markers. There are several shapes available out of the box, as well as it is possible to define custom shapes of the Point Markers.

    Note

    For the detailed description of Point Markers, please see the PointMarkers API article.

    Similarly to the FastColumnRenderableSeries type, it is possible to specify the baseline position for series' bars via the zeroLineY property. All data points that have Y value less than ZeroLineY (baseline) will be drawn downwards, else - upwards:

    Impulse Series Baseline

    Finally, the stem color can be changed via the strokeStyle property.

    Note

    To learn more about Pens and Brushes and how to utilize them, please refer to the PenStyle, BrushStyle and FontStyle article.

    Note

    In multi axis scenarios, a series has to be assigned to particular X and Y axes. This can be done passing the axes IDs to the xAxisId, yAxisId properties.

    Create an Impulse Series

    To create an Impulse Series, use the following code:

    • Java
    • Java with Builders API
    • Kotlin
    @Override
    protected void initExample(@NonNull SciChartSurface surface) {
        final IXyDataSeries<Double, Double> dataSeries = new XyDataSeries<>(Double.class, Double.class);
        dataSeries.append(0.0, -3.0);
        dataSeries.append(1.0, 1.0);
        dataSeries.append(2.0, 4.0);
    
        final EllipsePointMarker pointMarker = new EllipsePointMarker();
    
        pointMarker.setFillStyle(new SolidBrushStyle(Color.CYAN));
        pointMarker.setSize(20,20);
    
        final FastImpulseRenderableSeries impulseSeries = new FastImpulseRenderableSeries();
    
        impulseSeries.setDataSeries(dataSeries);
        impulseSeries.setStrokeStyle(new SolidPenStyle(Color.RED, true, 1f, null));
        impulseSeries.setPointMarker(pointMarker);
    
        UpdateSuspender.using(surface, () -> {
            Collections.addAll(surface.getXAxes(), new NumericAxis(requireContext()));
            Collections.addAll(surface.getYAxes(), new NumericAxis(requireContext()));
    
            Collections.addAll(surface.getRenderableSeries(), impulseSeries);
        });
    }
    
    @Override
    protected void initExample(@NonNull SciChartSurface surface) {
        final IXyDataSeries<Double, Double> dataSeries = sciChartBuilder.newXyDataSeries(Double.class, Double.class).build();
        dataSeries.append(0.0, -3.0);
        dataSeries.append(1.0, 1.0);
        dataSeries.append(2.0, 4.0);
    
        final EllipsePointMarker pointMarker = sciChartBuilder.newPointMarker(new EllipsePointMarker())
                .withFill(Color.CYAN)
                .withSize(20)
                .build();
    
        final FastLineRenderableSeries impulsSeries = sciChartBuilder.newLineSeries()
                .withDataSeries(dataSeries)
                .withStrokeStyle(Color.RED, 1f, true)
                .withPointMarker(pointMarker)
                .build();
    
        UpdateSuspender.using(surface, () -> {
            Collections.addAll(surface.getXAxes(), sciChartBuilder.newNumericAxis().build());
            Collections.addAll(surface.getYAxes(), sciChartBuilder.newNumericAxis().build());
    
            Collections.addAll(surface.getRenderableSeries(), impulsSeries);
        });
    }
    
    override fun initExample(surface: SciChartSurface) {
        val impulseSeries = FastImpulseRenderableSeries().apply {
            dataSeries = XyDataSeries(Double::class.javaObjectType, Double::class.javaObjectType).apply {
                append(0.0, -3.0)
                append(1.0, 1.0)
                append(2.0, 4.0)
            }
    
            strokeStyle = SolidPenStyle(Color.RED, true, 1f, null)
            pointMarker = EllipsePointMarker().apply {
                fillStyle = SolidBrushStyle(Color.CYAN)
                width = 20
                height = 20
            }
        }
    
        UpdateSuspender.using(surface) {
            Collections.addAll(surface.xAxes, NumericAxis(context))
            Collections.addAll(surface.yAxes, NumericAxis(context))
    
            Collections.addAll(surface.renderableSeries, impulseSeries)
        }
    }
    

    The result should be:

    Impulse Series Type

    Impulse Series Features

    Impulse Series also has some features similar to other series, such as:

    • Render a Gap;
    • Draw Series With Different Colors.

    Render a Gap in a Impulse Series

    It's possible to render a Gap in an Impulse series, by passing a data point with a NaN as the Y value. Please refer to the RenderableSeries APIs article for more details.

    Specify Color for Individual Bars

    In SciChart, you can draw each bar of the Impulse Series with different colors using the PaletteProvider API. To Use palette provider for Impulse Series - a custom IFillPaletteProvider (or IStrokePaletteProvider) has to be provided to the paletteProvider property. Please refer to the PaletteProvider API article for more info.

    Back to top © 2011-2025 SciChart. All rights reserved. | sitemap.xml