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.
This example showcases a Vertical Android chart with XAxis on the Left, Right, and YAxes at the Top. SciChart Android supports unlimited X and Y axis and allows placement of any axis on the Left, Right, Top, Bottom of the chart.
The Vertical Chart is created by calling setAxisAlignment(AxisAlignment.Left) on XAxis, and setAxisAlignment(AxisAlignment.Top) on YAxis.
This type of chart is useful in the Oil & Gas industry, where Android Charts might be used to visualize Drill Depth.
The full source code for the Android Vertical Charts 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-2017. All rights reserved.
//
// Web: http://www.scichart.com
// Support: support@scichart.com
// Sales: sales@scichart.com
//
// VerticalChartsFragment.java is part of the SCICHART® Examples. Permission is hereby granted
// to modify, create derivative works, distribute and publish any part of this source
// code whether for commercial, private or personal use.
//
// The SCICHART® examples are distributed in the hope that they will be useful, but
// without any warranty. It is provided "AS IS" without warranty of any kind, either
// expressed or implied.
//******************************************************************************
package com.scichart.examples.fragments;
import android.view.animation.DecelerateInterpolator;
import com.scichart.charting.model.dataSeries.IXyDataSeries;
import com.scichart.charting.visuals.SciChartSurface;
import com.scichart.charting.visuals.axes.AxisAlignment;
import com.scichart.charting.visuals.axes.IAxis;
import com.scichart.charting.visuals.renderableSeries.FastLineRenderableSeries;
import com.scichart.core.framework.UpdateSuspender;
import com.scichart.core.model.DoubleValues;
import com.scichart.data.model.DoubleRange;
import com.scichart.drawing.utility.ColorUtil;
import com.scichart.examples.R;
import com.scichart.examples.data.DataManager;
import com.scichart.examples.fragments.base.ExampleBaseFragment;
import java.util.Collections;
import butterknife.BindView;
public class VerticalChartsFragment extends ExampleBaseFragment {
@BindView(R.id.chart)
SciChartSurface surface;
@Override
public boolean showDefaultModifiersInToolbar() {
return false;
}
@Override
protected int getLayoutId() {
return R.layout.example_single_chart_fragment;
}
@Override
protected void initExample() {
final IAxis xAxis = sciChartBuilder.newNumericAxis().withAxisAlignment(AxisAlignment.Left).withAxisTitle("X-Axis").build();
final IAxis yAxis = sciChartBuilder.newNumericAxis().withAxisAlignment(AxisAlignment.Top).withAxisTitle("Y-Axis").withGrowBy(new DoubleRange(0d, 0.1d)).build();
IXyDataSeries<Double, Double> dataSeries0 = sciChartBuilder.newXyDataSeries(Double.class, Double.class).build();
IXyDataSeries<Double, Double> dataSeries1 = sciChartBuilder.newXyDataSeries(Double.class, Double.class).build();
final DoubleValues xValues = new DoubleValues();
final DoubleValues yValues = new DoubleValues();
DataManager.getInstance().setRandomDoubleSeries(xValues, yValues, 20);
dataSeries0.append(xValues, yValues);
xValues.clear();
yValues.clear();
DataManager.getInstance().setRandomDoubleSeries(xValues, yValues, 20);
dataSeries1.append(xValues, yValues);
final FastLineRenderableSeries lineSeries0 = sciChartBuilder.newLineSeries()
.withDataSeries(dataSeries0)
.withStrokeStyle(ColorUtil.SteelBlue, 2, true)
.build();
final FastLineRenderableSeries lineSeries1 = sciChartBuilder.newLineSeries()
.withDataSeries(dataSeries1)
.withStrokeStyle(ColorUtil.Lime, 2, true)
.build();
UpdateSuspender.using(surface, new Runnable() {
@Override
public void run() {
Collections.addAll(surface.getXAxes(), xAxis);
Collections.addAll(surface.getYAxes(), yAxis);
Collections.addAll(surface.getRenderableSeries(), lineSeries0, lineSeries1);
Collections.addAll(surface.getChartModifiers(), sciChartBuilder.newModifierGroupWithDefaultModifiers().build());
sciChartBuilder.newAnimator(lineSeries0).withSweepTransformation().withInterpolator(new DecelerateInterpolator()).withDuration(3000).withStartDelay(350).start();
sciChartBuilder.newAnimator(lineSeries1).withSweepTransformation().withInterpolator(new DecelerateInterpolator()).withDuration(3000).withStartDelay(350).start();
}
});
}
}