Search Results for

    Show / Hide Table of Contents

    The Spline Mountain (Area) Series Type

    Spline Mountain (Area) Series can be created using the SplineMountainRenderableSeries type.

    Spline Mountain Series Type

    Note

    Examples of the Spline Mountain Series can be found in the SciChart Android Examples Suite as well as on GitHub:

    • Native Example
    • Xamarin Example

    The SplineMountainRenderableSeries class allows to specify Stroke pen and Area brush. Those values can be assigned through the corresponding properties - strokeStyle and areaStyle accordingly.

    Note

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

    It is possible to define the ZeroLineY baseline position for a Spline Mountain Series via the zeroLineY property. All data points that have Y value less than ZeroLineY will appear downward, else - upward.

    Note

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

    Create a Spline Mountain Series

    To create a Spline Mountain Series, use the following code:

    • Java
    • Java with Builders API
    • Kotlin
    @Override
    protected void initExample(@NonNull SciChartSurface surface) {
        final IXyDataSeries<Double, Double> xyDataSeries = new XyDataSeries<>(Double.class, Double.class);
        xyDataSeries.append(0.0, 0.0);
        xyDataSeries.append(1.0, 1.0);
        xyDataSeries.append(2.0, 4.0);
    
        final SplineMountainRenderableSeries splineMountainSeries = new SplineMountainRenderableSeries();
    
        splineMountainSeries.setDataSeries(xyDataSeries);
        splineMountainSeries.setAreaStyle(new SolidBrushStyle(Color.CYAN));
        splineMountainSeries.setStrokeStyle(new SolidPenStyle(Color.RED, true, 1f, null));
    
        UpdateSuspender.using(surface, () -> {
            Collections.addAll(surface.getXAxes(), new NumericAxis(requireContext()));
            Collections.addAll(surface.getYAxes(), new NumericAxis(requireContext()));
    
            Collections.addAll(surface.getRenderableSeries(), splineMountainSeries);
        });
    }
    
    @Override
    protected void initExample(@NonNull SciChartSurface surface) {
        final IXyDataSeries<Double, Double> dataSeries = sciChartBuilder.newXyDataSeries(Double.class, Double.class).build();
        dataSeries.append(0.0, 0.0);
        dataSeries.append(1.0, 1.0);
        dataSeries.append(2.0, 4.0);
    
        final SplineMountainRenderableSeries splineMountainSeries = sciChartBuilder.newSplineMountainSeries()
                .withDataSeries(dataSeries)
                .withAreaFillColor(Color.CYAN)
                .withStrokeStyle(Color.RED, 1f, true)
                .build();
    
        UpdateSuspender.using(surface, () -> {
            Collections.addAll(surface.getXAxes(), sciChartBuilder.newNumericAxis().build());
            Collections.addAll(surface.getYAxes(), sciChartBuilder.newNumericAxis().build());
    
            Collections.addAll(surface.getRenderableSeries(), splineMountainSeries);
        });
    }
    
    override fun initExample(surface: SciChartSurface) {
        val splineMountainSeries = SplineMountainRenderableSeries().apply {
            dataSeries = XyDataSeries(Double::class.javaObjectType, Double::class.javaObjectType).apply {
                append(0.0, 0.0)
                append(1.0, 1.0)
                append(2.0, 4.0)
            }
    
            areaStyle = SolidBrushStyle(Color.CYAN)
            strokeStyle = SolidPenStyle(Color.RED, true, 1f, null)
        }
    
        UpdateSuspender.using(surface) {
            Collections.addAll(surface.xAxes, NumericAxis(context))
            Collections.addAll(surface.yAxes, NumericAxis(context))
    
            Collections.addAll(surface.renderableSeries, splineMountainSeries)
        }
    }
    

    Spline Mountain Series Features

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

    • Render a Gap;
    • Draw Point Markers;
    • Draw Series with Different Colors.

    Render a Gap in a Spline Mountain Series

    It's possible to render a Gap in Spline Mountain series, by passing a data point with a NaN as the Y value. Please refer to the RenderableSeries APIs article for more details. The SplineMountainRenderableSeries, itself, allows to specify how a gap would appear. You can treat NAN values as a gap or a close the line. That appearance is defined by the drawNaNAs property (Please see LineDrawMode enumeration).

    Note

    Please note, even though Gaps via NaN values in spline series is supported, ClosedGaps feature, which is available in regular (non-spline) series, aren't supported with splines.

    Add Point Markers onto a Spline Mountain Series

    Every data point of a Mountain Series can be marked with a IPointMarker. To add Point Markers to a Spline Mountain Series use the pointMarker property. For more information and code examples, please refer to the PointMarkers API article.

    Paint Area Parts with Different Colors

    In SciChart, you can draw Area Parts of the Spline Mountain Series with different colors using the PaletteProvider API. To Use palette provider for Spline Mountain Area - 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