Search in sources :

Example 26 with BarData

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

the class PlotLegendRender method convertArrayBarKey.

private void convertArrayBarKey(List<BarData> dataSet) {
    if (null == dataSet)
        return;
    String key = "";
    for (BarData cData : dataSet) {
        key = cData.getKey();
        if (!isDrawKey(key))
            continue;
        if ("" == key)
            continue;
        mLstKey.add(key);
        mLstColor.add(cData.getColor());
        PlotDot dot = new PlotDot();
        dot.setDotStyle(XEnum.DotStyle.RECT);
        mLstDotStyle.add(dot);
    }
}
Also used : BarData(org.xclcharts.chart.BarData) PlotDot(org.xclcharts.renderer.line.PlotDot)

Example 27 with BarData

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

the class BarChart12View method chartDataSet2.

private void chartDataSet2() {
    // 标签对应的柱形数据集
    List<Double> dataSeriesA = new LinkedList<Double>();
    dataSeriesA.add(80d);
    dataSeriesA.add(85d);
    dataSeriesA.add(90d);
    dataSeriesA.add(95d);
    // 依数据值确定对应的柱形颜色.
    List<Integer> dataColorA = new LinkedList<Integer>();
    dataColorA.add(Color.rgb(255, 95, 6));
    dataColorA.add(Color.rgb(55, 61, 65));
    dataColorA.add(Color.rgb(162, 144, 98));
    dataColorA.add(Color.rgb(66, 115, 156));
    chartData2.clear();
    chartData2.add(new BarData("", dataSeriesA, dataColorA, Color.rgb(53, 169, 239)));
}
Also used : BarData(org.xclcharts.chart.BarData) LinkedList(java.util.LinkedList)

Example 28 with BarData

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

the class BarChart12View method chartDataSet.

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

Example 29 with BarData

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

the class SpinnerBarChart01View method chartDataSet.

private void chartDataSet() {
    // 标签对应的柱形数据集
    List<Double> dataSeriesA = new LinkedList<Double>();
    dataSeriesA.add(50d);
    dataSeriesA.add(25d);
    dataSeriesA.add(20d);
    BarData BarDataA = new BarData("Google", dataSeriesA, Color.rgb(73, 135, 218));
    List<Double> dataSeriesB = new LinkedList<Double>();
    dataSeriesB.add(35d);
    dataSeriesB.add(65d);
    dataSeriesB.add(75d);
    BarData BarDataB = new BarData("Baidu", dataSeriesB, Color.rgb(224, 4, 0));
    List<Double> dataSeriesC = new LinkedList<Double>();
    dataSeriesC.add(15d);
    dataSeriesC.add(10d);
    dataSeriesC.add(5d);
    BarData BarDataC = new BarData("Bing", dataSeriesC, Color.rgb(255, 185, 0));
    chartData.add(BarDataA);
    chartData.add(BarDataB);
    chartData.add(BarDataC);
}
Also used : BarData(org.xclcharts.chart.BarData) LinkedList(java.util.LinkedList)

Example 30 with BarData

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

the class StackBarChart02View method triggerClick.

// 触发监听
private void triggerClick(float x, float y) {
    BarPosition record = chart.getPositionRecord(x, y);
    if (null == record)
        return;
    if (record.getDataID() >= BarDataSet.size())
        return;
    BarData bData = BarDataSet.get(record.getDataID());
    Double bValue = bData.getDataSet().get(record.getDataChildID());
    chart.showFocusRectF(record.getRectF());
    chart.getFocusPaint().setStyle(Style.FILL);
    chart.getFocusPaint().setStrokeWidth(3);
    chart.getFocusPaint().setColor(Color.GRAY);
    chart.getFocusPaint().setAlpha(100);
    // 在点击处显示tooltip
    pToolTip.setColor(Color.WHITE);
    chart.getToolTip().setAlign(Align.CENTER);
    chart.getToolTip().getBackgroundPaint().setColor(Color.BLUE);
    chart.getToolTip().setInfoStyle(XEnum.DyInfoStyle.CAPROUNDRECT);
    // chart.getToolTip().setCurrentXY(x,y);
    chart.getToolTip().setCurrentXY(record.getRectF().centerX(), record.getRectF().top);
    chart.getToolTip().addToolTip(" Current Value:" + Double.toString(bValue), pToolTip);
    this.invalidate();
}
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