如何使用MPchart库在散点图中设置“圆”的背景色?

时间:2018-08-07 06:26:38

标签: android graph scatter-plot

我正在使用MPChart库创建散点图。我想设置圆形的边框颜色,并从内部设置透明。如下图所示:

enter image description here

这是我的代码:

  ArrayList<String> xvals = new ArrayList<String>();
    List<IScatterDataSet> yset = new ArrayList<IScatterDataSet>();
    List<Entry> entries = new ArrayList<Entry>();

    for (int i = 0; i < dataSets; i++) {


        entries.add(new Entry(4f, 0));
                entries.add(new Entry(8f, 1));
                entries.add(new Entry(6f, 2));
                entries.add(new Entry(12f, 3));
                entries.add(new Entry(18f, 4));
                entries.add(new Entry(9f, 5));



    }
    ScatterDataSet ds = new ScatterDataSet(entries, "label");
    ds.setScatterShapeSize(12f);
    //ds.setColor(Color.TRANSPARENT);
    ds.setScatterShapeSize(9f);
    ds.setScatterShape(ScatterChart.ScatterShape.CIRCLE) ;

    ds.setColor(getResources().getColor(R.color.defaultTextColor));
    yset.add(ds);
    ArrayList<String> labels = new ArrayList<String>();
    labels.add("January");
    labels.add("February");
    labels.add("March");

    ScatterData data = new ScatterData( ds);

0 个答案:

没有答案