Search in sources :

Example 11 with BarData

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

the class BarChart09View method chartDataSet.

private void chartDataSet() {
    // 标签对应的柱形数据集
    List<Double> dataSeriesA = new LinkedList<Double>();
    dataSeriesA.add((double) 200);
    dataSeriesA.add((double) 250);
    dataSeriesA.add((double) 400);
    BarData BarDataA = new BarData("小熊", dataSeriesA, Color.rgb(0, 0, 255));
    List<Double> dataSeriesB = new LinkedList<Double>();
    dataSeriesB.add((double) 300);
    dataSeriesB.add((double) 150);
    dataSeriesB.add((double) 450);
    BarData BarDataB = new BarData("小周", dataSeriesB, Color.rgb(255, 0, 0));
    chartData.add(BarDataA);
    chartData.add(BarDataB);
}
Also used : BarData(org.xclcharts.chart.BarData) LinkedList(java.util.LinkedList)

Example 12 with BarData

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

the class BarChart11View method chartDataSet.

private void chartDataSet() {
    // 标签对应的柱形数据集
    List<Double> dataSeriesA = new LinkedList<Double>();
    // 依数据值确定对应的柱形颜色.
    List<Integer> dataColorA = new LinkedList<Integer>();
    dataSeriesA.add(7.9d);
    dataColorA.add(Color.rgb(205, 5, 5));
    dataSeriesA.add(7.8d);
    dataColorA.add(Color.rgb(205, 5, 5));
    dataSeriesA.add(7.3d);
    dataColorA.add(Color.rgb(203, 203, 203));
    dataSeriesA.add(6.9d);
    dataColorA.add(Color.rgb(203, 203, 203));
    dataSeriesA.add(6.9d);
    dataColorA.add(Color.rgb(203, 203, 203));
    dataSeriesA.add(6.4d);
    dataColorA.add(Color.rgb(203, 203, 203));
    dataSeriesA.add(7.2d);
    dataColorA.add(Color.rgb(137, 137, 137));
    // 此地的颜色为Key值颜色及柱形的默认颜色
    BarData BarDataA = new BarData("", dataSeriesA, dataColorA, Color.rgb(53, 169, 239));
    chartData.add(BarDataA);
}
Also used : BarData(org.xclcharts.chart.BarData) LinkedList(java.util.LinkedList)

Example 13 with BarData

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

the class BarChart01View method chartDataSet.

private void chartDataSet() {
    // 标签对应的柱形数据集
    List<Double> dataSeriesA = new ArrayList<Double>();
    dataSeriesA.add(66d);
    dataSeriesA.add(33d);
    dataSeriesA.add(50d);
    BarData BarDataA = new BarData("Oracle", dataSeriesA, colorORACLE);
    List<Double> dataSeriesB = new ArrayList<Double>();
    // 32
    dataSeriesB.add(0.d);
    dataSeriesB.add(25d);
    dataSeriesB.add(18d);
    BarData BarDataB = new BarData("SQL Server", dataSeriesB, colorMSSQL);
    List<Double> dataSeriesC = new ArrayList<Double>();
    dataSeriesC.add(79d);
    dataSeriesC.add(91d);
    dataSeriesC.add(65d);
    BarData BarDataC = new BarData("MySQL", dataSeriesC, colorMYSQL);
    List<Double> dataSeriesD = new ArrayList<Double>();
    dataSeriesD.add(52d);
    dataSeriesD.add(45d);
    dataSeriesD.add(35d);
    BarData BarDataD = new BarData("其它类型", dataSeriesD, colorOTHER);
    chartData.add(BarDataA);
    chartData.add(BarDataB);
    chartData.add(BarDataC);
    chartData.add(BarDataD);
}
Also used : BarData(org.xclcharts.chart.BarData) ArrayList(java.util.ArrayList)

Example 14 with BarData

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

the class BarChart03View method chartAnimation.

private void chartAnimation() {
    try {
        for (int i = 0; i < chartData.size(); i++) {
            BarData barData = chartData.get(i);
            for (int j = 0; j < barData.getDataSet().size(); j++) {
                Thread.sleep(100);
                List<BarData> animationData = new LinkedList<BarData>();
                List<Double> dataSeries = new LinkedList<Double>();
                List<Integer> dataColorA = new LinkedList<Integer>();
                for (int k = 0; k <= j; k++) {
                    dataSeries.add(barData.getDataSet().get(k));
                    dataColorA.add(barData.getDataColor().get(k));
                }
                BarData animationBarData = new BarData("", dataSeries, dataColorA, Color.rgb(53, 169, 239));
                animationData.add(animationBarData);
                chart.setDataSource(animationData);
                postInvalidate();
            }
        }
    } catch (Exception e) {
        Thread.currentThread().interrupt();
    }
}
Also used : BarData(org.xclcharts.chart.BarData) LinkedList(java.util.LinkedList)

Example 15 with BarData

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

the class BarChart03View method chartDataSet.

private void chartDataSet() {
    // 标签对应的柱形数据集
    List<Double> dataSeriesA = new LinkedList<Double>();
    dataSeriesA.add(98d);
    dataSeriesA.add(100d);
    dataSeriesA.add(95d);
    dataSeriesA.add(100d);
    // 依数据值确定对应的柱形颜色.
    List<Integer> dataColorA = new LinkedList<Integer>();
    dataColorA.add(Color.RED);
    dataColorA.add(Color.BLUE);
    dataColorA.add(Color.GREEN);
    dataColorA.add(Color.YELLOW);
    // BarData BarDataA = new BarData("",dataSeriesA,dataColorA,(int)Color.rgb(53, 169, 239));
    chartData.clear();
    chartData.add(new BarData("", dataSeriesA, dataColorA, Color.rgb(53, 169, 239)));
}
Also used : BarData(org.xclcharts.chart.BarData) LinkedList(java.util.LinkedList)

Aggregations

BarData (org.xclcharts.chart.BarData)36 LinkedList (java.util.LinkedList)25 BarPosition (org.xclcharts.event.click.BarPosition)9 Random (java.util.Random)4 Paint (android.graphics.Paint)2 SuppressLint (android.annotation.SuppressLint)1 ArrayList (java.util.ArrayList)1 PlotDot (org.xclcharts.renderer.line.PlotDot)1