Search in sources :

Example 16 with BarData

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

the class BarChart05View 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>();
                for (int k = 0; k <= j; k++) {
                    dataSeries.add(barData.getDataSet().get(k));
                }
                BarData animationBarData = new BarData("", dataSeries, 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 17 with BarData

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

the class BarChart05View method chartDataSet.

private void chartDataSet() {
    // 标签对应的柱形数据集
    List<Double> dataSeriesA = new LinkedList<Double>();
    dataSeriesA.add(98d);
    dataSeriesA.add(100d);
    dataSeriesA.add(95d);
    dataSeriesA.add(100d);
    BarData BarDataA = new BarData("", dataSeriesA, Color.rgb(53, 169, 239));
    chartData.add(BarDataA);
}
Also used : BarData(org.xclcharts.chart.BarData) LinkedList(java.util.LinkedList)

Example 18 with BarData

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

the class BarChart13View method chartDataSet.

private void chartDataSet() {
    // 标签对应的柱形数据集
    List<Double> dataSeriesA = new LinkedList<Double>();
    // 依数据值确定对应的柱形颜色.
    List<Integer> dataColorA = new LinkedList<Integer>();
    dataSeriesA.add((double) 400);
    dataSeriesA.add((double) 350);
    dataSeriesA.add((double) 300);
    dataSeriesA.add((double) 250);
    dataSeriesA.add((double) 200);
    dataColorA.add(Color.rgb(152, 211, 19));
    dataColorA.add(Color.rgb(252, 212, 290));
    dataColorA.add(Color.rgb(212, 213, 19));
    dataColorA.add(Color.rgb(222, 214, 290));
    dataColorA.add(Color.rgb(232, 215, 39));
    // 此地的颜色为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 19 with BarData

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

the class BarChart3D02View method chartDataSet.

private void chartDataSet() {
    // 标签对应的柱形数据集
    List<Double> dataSeriesA = new LinkedList<Double>();
    dataSeriesA.add(20d);
    dataSeriesA.add(28d);
    dataSeriesA.add(45d);
    List<Double> dataSeriesB = new LinkedList<Double>();
    dataSeriesB.add(30d);
    dataSeriesB.add(17d);
    dataSeriesB.add(35d);
    chartData.add(new BarData("湖南", dataSeriesA, Color.rgb(224, 62, 54)));
    chartData.add(new BarData("福建", dataSeriesB, Color.rgb(140, 71, 222)));
}
Also used : BarData(org.xclcharts.chart.BarData) LinkedList(java.util.LinkedList)

Example 20 with BarData

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

the class BarChart3D02View method triggerClick.

// 触发监听
private void triggerClick(float x, float y) {
    BarPosition record = chart.getPositionRecord(x, y);
    if (null == record)
        return;
    BarData bData = chartData.get(record.getDataID());
    Double bValue = bData.getDataSet().get(record.getDataChildID());
    Toast.makeText(this.getContext(), "info:" + record.getRectInfo() + " Key:" + bData.getKey() + " Current Value:" + Double.toString(bValue), Toast.LENGTH_SHORT).show();
}
Also used : BarData(org.xclcharts.chart.BarData) BarPosition(org.xclcharts.event.click.BarPosition)

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