Search code examples
javaandroidcontourteechart

TeeChart Contour lines color


I use TeeChart JAVA for Android to create a contour.

Series series = Series.createNewSeries(mChart.getChart(), Contour.class, null);
mContour = (Contour) series;

mContour.setAutomaticLevels(true);
mContour.setNumLevels(15);

The color transition from blue to white is set by default to draw contour lines. I need to change it from red to green. So the largest value will be red and the smallest one will be green.

This is what happens by default: This is what happens by default


Solution

  • You should change ColorRange settings, for example:

    tChart1.getAspect().setView3D(false);
    
    Contour series1 = new Contour(this.tChart1.getChart());
    
    series1.fillSampleValues();
    
    series1.setUseColorRange(true);
    series1.setUsePalette(false);
    series1.setStartColor(Color.GREEN);
    series1.setEndColor(Color.RED);
    series1.setMidColor(Color.TRANSPARENT);