Search code examples
androidteechart

IsoSurface fillSampleValues


I'm looking at the given example code for the IsoSurface. I want to create a chart that looks similar to the example code but I'm not able to recreate the data points needed for that (since it's using fillSampleValues()). What values does the example (shown below) use? Thanks!

Edit: I'm specifically interested in how to make it flat and how to create the peak. When I try entering my own x, y, z values, the chart doesn't show up. I'm guessing that's because I'm not entering valid values. So that's why I'm curious to see what the fillSampleValues are and how it creates the chart.

series = Series.createNewSeries(chart.getChart(), IsoSurface.class, null);
        series.fillSampleValues();
        chart.addSeries(series);
        chart.getLegend().setAlignment(LegendAlignment.BOTTOM);
        chart.getHeader().setText("ISOSurface Series");
        chart.getHeader().getFont().setSize(14);
        chart.getAspect().setOrthogonal(false);
        chart.getAspect().setZoom(70);              
        chart.getAspect().setRotation(320);
        chart.getAspect().setElevation(340);
        chart.getAspect().setPerspective(37);
        chart.getAspect().setChart3DPercent(90);
        ((IsoSurface) series).setPaletteStyle(PaletteStyle.RAINBOW);

Solution

  • The random values in the Surface series are calculated as in the following example:

    Surface surf1 = new Surface(tChart1.getChart());
    int nValues = 10;
    for (int z=1; z<=nValues; z++) {
        for (int x=1; x<=nValues; x++) {
            surf1.add(x, 0.5 * Utils.pow(Math.cos(x / (nValues * 0.2)), 2) +
                Utils.pow(Math.cos(z / (nValues * 0.2)), 2) -
                Math.cos(z / (nValues * 0.5)), z);
        }
    }