MPandroid图表Xline为什么看到数据之间的值

时间:2016-08-10 06:00:30

标签: java android mpandroidchart

ScatterChart scatterChart = (ScatterChart) findViewById(R.id.chart);      

ScatterDataSet dataset = new ScatterDataSet(entries, "온도");

//ArrayList<String> labels = new ArrayList<String>();

ScatterData data = new ScatterData(labels, dataset);
scatterChart.setData(data);


scatterChart.setDescription("Description");        
dataset.setColors(ColorTemplate.COLORFUL_COLORS); //
dataset.setScatterShapeSize(8);
dataset.setScatterShape(ScatterChart.ScatterShape.CIRCLE);
scatterChart.animateY(2000);      

scatterChart.setScaleXEnabled(false);
scatterChart.setScaleYEnabled(false);
scatterChart.notifyDataSetChanged();

请参阅图片。

enter image description here

1 个答案:

答案 0 :(得分:0)

并不是因为空间有限而导致您的图表被绘制的数据之间存在额外的值,而不是所有标签都在x轴上绘制。如果您真的想要显示所有标签,可以尝试以下方法:

@PropertySource("/WEB-INF/configDummy.properties")
public class TranslatorApi {

@Autowired
private Properties properties;

private static final Logger LOGGER = Logger.getLogger(TranslatorApi.class.getName());

public TranslatorApi() {}

public Properties getProperties() {
    return properties;
}

public void setProperties(Properties properties) {
    this.properties = properties;
}

public void writePropertiesFile(Elements elements, InputStream inputStream) {
    System.out.println("write opertion executed");
    System.out.println(elements);
    try {
        readPropertiesFile(inputStream);

        for(Element e : elements) {
            properties.setProperty(e.className(), e.text());
        }

        String path=Thread.currentThread().getContextClassLoader()
                .getResource("src/main/webapp/WEB-INF/props/configDummy.properties").toString();
        File file = new File(path);
        FileOutputStream fileOut = new FileOutputStream(file);
        properties.store(fileOut, "DUMMY");
        fileOut.close();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

private void readPropertiesFile(InputStream inputStream) throws IOException {
    try {
        properties.load(inputStream);
        inputStream.close();
    } catch(FileNotFoundException e) {
        LOGGER.log(Level.SEVERE, "FileNotFoundException has occured", e);
    } catch(IOException e) {
        LOGGER.log(Level.SEVERE, "IOException has occured", e);     
    } 
}