The Polar 3D Chart Type
In SciChart, Polar 3D Charts are provided by the combination of the Free Surface 3D Series and PolarDataSeries3D<TPolar,THeight> underlying DataSeries.
The location of the PolarDataSeries3D<TPolar,THeight> is defined by following properties:
- offsetX – a location of the Polar by the
X-Axis
; - offsetY – a location of the Polar by the
Y-Axis
; - offsetZ – a location of the Polar by the
Z-Axis
;
The size of the CylindroidDataSeries3D<TXZ,TY> is defined by following properties:
- a – a distance from the origin to the internal edge of the cylindroid 3D Surface;
- b – a distance from the origin to the external edge of the cylindroid 3D Surface;
Note
Examples for the Polar Series 3D can be found in the SciChart Android Examples Suite as well as on GitHub:
Create a Polar 3D Chart
To create a Polar 3D Chart, use the following code:
final int sizeU = 30, sizeV = 10;
final PolarDataSeries3D<Double, Double> meshDataSeries = new PolarDataSeries3D<>(Double.class, Double.class, sizeU, sizeV, 0d, Math.PI * 1.75);
meshDataSeries.setA(1d);
meshDataSeries.setB(5d);
final Random random = new Random();
for (int u = 0; u < sizeU; u++) {
final double weightU = 1d - Math.abs(2d * u / sizeU - 1d);
for (int v = 0; v < sizeV; v++) {
final double weightV = 1d - Math.abs(2d * v / sizeV - 1d);
final double offset = random.nextDouble();
meshDataSeries.setDisplacement(u, v, offset * weightU * weightV);
}
}
final int[] colors = new int[]{0xFF00008B, 0xFF0000FF, 0xFF00FFFF, 0xFFADFF2F, 0xFFFFFF00, 0xFFFF0000, 0xFF8B0000};
final float[] stops = new float[]{0, .1f, .3f, .5f, .7f, .9f, 1};
final GradientColorPalette palette = new GradientColorPalette(colors, stops);
final FreeSurfaceRenderableSeries3D rs = new FreeSurfaceRenderableSeries3D();
rs.setDataSeries(meshDataSeries);
rs.setDrawMeshAs(DrawMeshAs.SolidWireframe);
rs.setStroke(0x77228B22);
rs.setContourInterval(0.1f);
rs.setContourStroke(0x77228B22);
rs.setStrokeThickness(convertValueToDp(2f));
rs.setLightingFactor(0.8f);
rs.setMeshColorPalette(palette);
rs.setPaletteMinMaxMode(FreeSurfacePaletteMinMaxMode.Relative);
rs.setPaletteMinimum(new Vector3(0f, 0f, 0f));
rs.setPaletteMaximum(new Vector3(0f, 0.5f, 0f));
Note
See other constrained and unconstrained Free Surface Series types in the corresponding articles.