Search in sources :

Example 6 with AreaData

use of org.xclcharts.chart.AreaData in project XCL-Charts by xcltapestry.

the class AreaChart03View method chartDataSet.

private void chartDataSet() {
    // 将标签与对应的数据集分别绑定
    // 标签对应的数据集
    List<Double> dataSeries1 = new LinkedList<Double>();
    double[] testData = { 40, 21, 32, 56, 40, 54, 46, 32, 89, 76, 53, 62, 66, 78, 47, 53, 90, 80, 60, 82, 77, 67, 79, 85, 83, 90 };
    for (int i = 0; i < testData.length; i++) {
        dataSeries1.add(testData[i]);
        mLabels.add(Integer.toString(i));
    }
    // 设置每条线各自的显示属性
    // key,数据集,线颜色,区域颜色
    AreaData line1 = new AreaData("小熊", dataSeries1, Color.rgb(108, 180, 223), Color.YELLOW);
    // 不显示点
    line1.setDotStyle(XEnum.DotStyle.HIDE);
    line1.setApplayGradient(true);
    line1.setAreaBeginColor(Color.WHITE);
    line1.setAreaEndColor(Color.rgb(108, 180, 223));
    line1.setGradientDirection(XEnum.Direction.VERTICAL);
    mDataset.add(line1);
}
Also used : AreaData(org.xclcharts.chart.AreaData) LinkedList(java.util.LinkedList) Paint(android.graphics.Paint)

Example 7 with AreaData

use of org.xclcharts.chart.AreaData in project XCL-Charts by xcltapestry.

the class AreaChart02View method chartDataSet.

private void chartDataSet() {
    // 将标签与对应的数据集分别绑定
    // 标签对应的数据集
    List<Double> dataSeries1 = new LinkedList<Double>();
    // 0.001);  //25  0.001
    dataSeries1.add((double) 0);
    dataSeries1.add((double) 50);
    dataSeries1.add((double) 51);
    dataSeries1.add((double) 60);
    // 45
    dataSeries1.add((double) 0);
    List<Double> dataSeries2 = new LinkedList<Double>();
    // 40
    dataSeries2.add((double) 40);
    dataSeries2.add((double) 22);
    // dataSeries2.add((double)0); 	//30
    // dataSeries2.add((double)0); //35
    // 30
    dataSeries2.add((double) 30);
    // 35
    dataSeries2.add((double) 35);
    // 15
    dataSeries2.add((double) 15);
    List<Double> dataSeries3 = new LinkedList<Double>();
    // dataSeries3.add((double)50); //50
    // dataSeries3.add((double)62);
    // 70
    dataSeries3.add((double) 70);
    dataSeries3.add((double) 90);
    // dataSeries3.add((double)75);
    // 设置每条线各自的显示属性
    // key,数据集,线颜色,区域颜色
    AreaData line1 = new AreaData("小熊", dataSeries1, Color.parseColor("#4CA200"), Color.WHITE, Color.parseColor("#80C007"));
    // 不显示点
    // 隐藏图形
    line1.setDotStyle(XEnum.DotStyle.HIDE);
    // line1.setDotStyle(XEnum.DotStyle.RECT);
    // line1.setLabelVisible(true);
    line1.setApplayGradient(true);
    line1.setAreaBeginColor(Color.WHITE);
    line1.setAreaEndColor(Color.parseColor("#80C007"));
    AreaData line2 = new AreaData("小小熊", dataSeries2, Color.rgb(182, 23, 123), Color.rgb(255, 191, 235));
    // 设置线上每点对应标签的颜色
    line2.getDotLabelPaint().setColor(Color.rgb(83, 148, 235));
    // 设置点标签
    line2.setLabelVisible(true);
    line2.getDotLabelPaint().setTextAlign(Align.CENTER);
    line2.getLabelOptions().setLabelBoxStyle(XEnum.LabelBoxStyle.CIRCLE);
    line2.getLabelOptions().getBox().getBackgroundPaint().setColor(Color.GREEN);
    line2.getLabelOptions().setOffsetY(30.f);
    line2.setApplayGradient(true);
    line2.setGradientDirection(XEnum.Direction.HORIZONTAL);
    line2.setAreaBeginColor(Color.WHITE);
    line2.setAreaEndColor(Color.RED);
    // line2.setApplayGradient(true);
    // line2.setGradientMode(Shader.TileMode.MIRROR);
    // Color.RED,Color.WHITE  Color.WHITE,Color.RED
    AreaData line3 = new AreaData("小小小熊", dataSeries3, Color.parseColor("#B6D3FD"), Color.parseColor("#5394EB"));
    line3.setDotStyle(XEnum.DotStyle.HIDE);
    line3.setApplayGradient(true);
    mDataset.add(line3);
    mDataset.add(line1);
    mDataset.add(line2);
    List<Double> dataSeries4 = new LinkedList<Double>();
    dataSeries4.add((double) 0);
    dataSeries4.add((double) 55);
    dataSeries4.add((double) 0);
    dataSeries4.add((double) 0);
    dataSeries4.add((double) 65);
    List<Double> dataSeries5 = new LinkedList<Double>();
    dataSeries5.add((double) 36);
    dataSeries5.add((double) 37);
    dataSeries5.add((double) 0);
    dataSeries5.add((double) 0);
    dataSeries5.add((double) 0);
    List<Double> dataSeries6 = new LinkedList<Double>();
    dataSeries6.add((double) 36);
    dataSeries6.add((double) 0);
    dataSeries6.add((double) 0);
    dataSeries6.add((double) 0);
    dataSeries6.add((double) 73);
    AreaData line4 = new AreaData("line4", dataSeries4, Color.BLUE, Color.BLUE);
    // 设置线上每点对应标签的颜色
    // line3.getDotLabelPaint().setColor(Color.YELLOW);
    line4.setLineStyle(XEnum.LineStyle.DOT);
    AreaData line5 = new AreaData("line5", dataSeries5, Color.CYAN, Color.CYAN);
    // 设置线上每点对应标签的颜色
    // line3.getDotLabelPaint().setColor(Color.YELLOW);
    line5.setLineStyle(XEnum.LineStyle.SOLID);
    AreaData line6 = new AreaData("line6", dataSeries6, Color.YELLOW, Color.YELLOW);
    // 设置线上每点对应标签的颜色
    // line3.getDotLabelPaint().setColor(Color.YELLOW);
    line6.setLineStyle(XEnum.LineStyle.DASH);
    // 设置线上点的大小
    // line6.setDotRadius(radius)
    // 设置线的粗线
    // line6.getLinePaint().setStrokeWidth(5);
    mDataset.add(line4);
    mDataset.add(line5);
    mDataset.add(line6);
}
Also used : AreaData(org.xclcharts.chart.AreaData) LinkedList(java.util.LinkedList)

Aggregations

AreaData (org.xclcharts.chart.AreaData)7 LinkedList (java.util.LinkedList)4 PointPosition (org.xclcharts.event.click.PointPosition)3 Paint (android.graphics.Paint)1