Search Results for

    Show / Hide Table of Contents

    The Column Series Type

    Column Chart is provided by the FastColumnRenderableSeries class. It accepts data (X, Y) from a XyDataSeries<TX,TY> and renders a column at each [X, Y] value.

    Note

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

    • Native Example

    The FastColumnRenderableSeries class allows to specify Fill brush, Stroke pen and relative DataPointWidth which will be applied to every column. You can also choose the TextureMappingMode for Fill brush which defines how columns are filled when a gradient is used. The DataPointWidth specifies how much space a single column occupies, varying from 0 to 1 (when columns are conjoined).

    Note

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

    Also, it is possible to define the ZeroLineY baseline position via the zeroLineY property. All data points that have Y value less than ZeroLineY will appear downward, else - upward.

    All those values can be assigned via the corresponding properties:

    • fillBrushStyle
    • fillBrushMappingMode
    • strokeStyle
    • dataPointWidth
    • zeroLineY
    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 a Column Series

    Column Series Type

    To create a Column 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 FastColumnRenderableSeries columnSeries = new FastColumnRenderableSeries();
    
        columnSeries.setDataSeries(dataSeries);
        columnSeries.setFillBrushStyle(new SolidBrushStyle(Color.CYAN));
        columnSeries.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(), columnSeries);
        });
    }
    
    @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 FastColumnRenderableSeries columnSeries = sciChartBuilder.newColumnSeries()
                .withDataSeries(dataSeries)
                .withFillColor(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(), columnSeries);
        });
    }
    
    override fun initExample(surface: SciChartSurface) {
        val columnSeries = FastColumnRenderableSeries().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)
            }
    
            fillBrushStyle = 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, columnSeries)
        }
    }
    

    Column Series Features

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

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

    Render a Gap in a Column Series

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

    Paint Column Area Parts With Different Colors

    Paletted Column Series Type

    In SciChart, you can draw each column of the Column Series with different colors using the PaletteProvider API. To use palette provider for Columns - a custom IFillPaletteProvider (or IStrokePaletteProvider) has to be provided to the paletteProvider property.

    Please see the code snippet from our Column Chart Example. For more information - please refer to the PaletteProvider API article.

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