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 demonstrates how to set X, Y or Z Logarithmic Axis on a 3D Android Chart in SciChart.
The LogarithmicNumericAxis3D is a Logarithmic Value-Axis and is suitable when the data on that axis is a Numeric value e.g. Double, Int, Long, Float.
Read more about Android 3D Axis types in our SciChart 3D Android Chart Tutorial.
The full source code for the Android 3D Logarithmic Axis 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
//
// LogarithmicAxis3DFragment.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.examples3d.axis3D.kt
import com.scichart.charting.visuals.axes.ScientificNotation.LogarithmicBase
import com.scichart.charting.visuals.axes.ScientificNotation.None
import com.scichart.charting3d.visuals.SciChartSurface3D
import com.scichart.charting3d.visuals.renderableSeries.metadataProviders.PointMetadataProvider3D
import com.scichart.charting3d.visuals.renderableSeries.metadataProviders.PointMetadataProvider3D.PointMetadata3D
import com.scichart.data.model.DoubleRange
import com.scichart.examples.data.DataManager
import com.scichart.examples.fragments.base.ExampleSingleChart3DBaseFragment
import com.scichart.examples.utils.scichartExtensions.*
class LogarithmicAxis3DFragment : ExampleSingleChart3DBaseFragment() {
override fun initExample(surface3d: SciChartSurface3D) {
val count = 100
val dataManager = DataManager.getInstance()
val data = dataManager.getExponentialCurve(1.8, count)
val pointMetaDataProvider = PointMetadataProvider3D()
surface3d.suspendUpdates {
xAxis = logarithmicNumericAxis3D {
growBy = DoubleRange(0.1, 0.1)
drawMajorBands = false
textFormatting = "#.#e+0"
cursorTextFormatting = "0.0"
scientificNotation = LogarithmicBase
}
yAxis = logarithmicNumericAxis3D {
growBy = DoubleRange(0.1, 0.1)
drawMajorBands = false
textFormatting = "#.000"
cursorTextFormatting = "0.0"
scientificNotation = None
}
zAxis = numericAxis3D { growBy = DoubleRange(0.5, 0.5) }
renderableSeries {
pointLineRenderableSeries3D {
xyzDataSeries3D<Double, Double, Double> {
for (i in 0 until count) {
val x = data.xValues[i]
val y = data.yValues[i]
val z = dataManager.getGaussianRandomNumber(15.0, 1.5)
append(x, y, z)
pointMetaDataProvider.metadata.add(PointMetadata3D(dataManager.randomColor, dataManager.randomScale))
}
}
strokeThickness = 2f
spherePointMarker3D { size = 5f }
metadataProvider = pointMetaDataProvider
}
}
chartModifiers { defaultModifiers3D() }
}
}
}
//******************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2021. All rights reserved.
//
// Web: http://www.scichart.com
// Support: support@scichart.com
// Sales: sales@scichart.com
//
// LogarithmicAxis3DFragment.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.examples3d.axis3D;
import androidx.annotation.NonNull;
import com.scichart.charting.visuals.axes.ScientificNotation;
import com.scichart.charting3d.model.dataSeries.xyz.XyzDataSeries3D;
import com.scichart.charting3d.visuals.SciChartSurface3D;
import com.scichart.charting3d.visuals.axes.LogarithmicNumericAxis3D;
import com.scichart.charting3d.visuals.axes.NumericAxis3D;
import com.scichart.charting3d.visuals.pointMarkers.SpherePointMarker3D;
import com.scichart.charting3d.visuals.renderableSeries.metadataProviders.PointMetadataProvider3D;
import com.scichart.charting3d.visuals.renderableSeries.metadataProviders.PointMetadataProvider3D.PointMetadata3D;
import com.scichart.charting3d.visuals.renderableSeries.pointLine.PointLineRenderableSeries3D;
import com.scichart.core.framework.UpdateSuspender;
import com.scichart.examples.data.DataManager;
import com.scichart.examples.data.DoubleSeries;
import com.scichart.examples.fragments.base.ExampleSingleChart3DBaseFragment;
public class LogarithmicAxis3DFragment extends ExampleSingleChart3DBaseFragment {
@Override
protected void initExample(@NonNull SciChartSurface3D surface3d) {
final LogarithmicNumericAxis3D xAxis = sciChart3DBuilder.newLogarithmicNumericAxis3D()
.withGrowBy(0.1, 0.1)
.withDrawMajorBands(false)
.withTextFormatting("#.#e+0")
.withCursorTextFormating("0.0")
.withScientificNotation(ScientificNotation.LogarithmicBase)
.build();
final LogarithmicNumericAxis3D yAxis = sciChart3DBuilder.newLogarithmicNumericAxis3D()
.withGrowBy(0.1, 0.1)
.withDrawMajorBands(false)
.withTextFormatting("#.000")
.withCursorTextFormating("0.0")
.withScientificNotation(ScientificNotation.None)
.build();
final NumericAxis3D zAxis = sciChart3DBuilder.newNumericAxis3D()
.withGrowBy(0.5, 0.5)
.build();
final int count = 100;
final DataManager dataManager = DataManager.getInstance();
final DoubleSeries data = dataManager.getExponentialCurve(1.8, count);
final XyzDataSeries3D<Double, Double, Double> dataSeries = new XyzDataSeries3D<>(Double.class, Double.class, Double.class);
final PointMetadataProvider3D pointMetaDataProvider = new PointMetadataProvider3D();
for (int i = 0; i < count; i++) {
final double x = data.xValues.get(i);
final double y = data.yValues.get(i);
final double z = dataManager.getGaussianRandomNumber(15, 1.5);
dataSeries.append(x, y, z);
pointMetaDataProvider.metadata.add(new PointMetadata3D(dataManager.getRandomColor(), dataManager.getRandomScale()));
}
final SpherePointMarker3D pointMarker3D = sciChart3DBuilder.newSpherePointMarker3D()
.withSize(5f)
.build();
final PointLineRenderableSeries3D rs = sciChart3DBuilder.newPointLinesSeries3D()
.withDataSeries(dataSeries)
.withStrokeThicknes(2)
.withPointMarker(pointMarker3D)
.withMetadataProvider(pointMetaDataProvider)
.build();
UpdateSuspender.using(surface3d, () -> {
surface3d.setXAxis(xAxis);
surface3d.setYAxis(yAxis);
surface3d.setZAxis(zAxis);
surface3d.getRenderableSeries().add(rs);
surface3d.getChartModifiers().add(sciChart3DBuilder.newModifierGroupWithDefaultModifiers().build());
});
}
}