Search in sources :

Example 21 with BarData

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

the class MultiAxisChart02View method chartDataLnSet.

private void chartDataLnSet() {
    // 标签1对应的柱形数据集
    List<Double> dataSeries1 = new LinkedList<Double>();
    dataSeries1.add(40000d);
    dataSeries1.add(73000d);
    // dataSeries1.add(400d);
    List<Double> dataSeries2 = new LinkedList<Double>();
    dataSeries2.add(45000d);
    dataSeries2.add(85000d);
    // dataSeries2.add(450d);
    BarData BarDataA = new BarData("Virtual OPM", dataSeries1, Color.rgb(0, 221, 177));
    BarData BarDataB = new BarData("Physical OPM", dataSeries2, Color.rgb(238, 28, 161));
    chartData.add(BarDataA);
    chartData.add(BarDataB);
}
Also used : BarData(org.xclcharts.chart.BarData) LinkedList(java.util.LinkedList)

Example 22 with BarData

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

the class StackBarChart01View 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());
    int cid = record.getDataChildID();
    Double bValue = bData.getDataSet().get(cid);
    String label = chartLabels.get(cid);
    chart.showFocusRectF(record.getRectF());
    chart.getFocusPaint().setStyle(Style.FILL);
    chart.getFocusPaint().setStrokeWidth(3);
    chart.getFocusPaint().setColor(Color.GREEN);
    chart.getFocusPaint().setAlpha(100);
    // 在点击处显示tooltip
    pToolTip.setColor(Color.WHITE);
    chart.getToolTip().setAlign(Align.CENTER);
    chart.getToolTip().setInfoStyle(XEnum.DyInfoStyle.CIRCLE);
    chart.getToolTip().getBackgroundPaint().setColor(Color.BLACK);
    // chart.getToolTip().setCurrentXY(record.getRectF().centerX(),record.getRectF().centerY());
    chart.getToolTip().setCurrentXY(x, y);
    chart.getToolTip().addToolTip(label + " Current Value:" + Double.toString(bValue), pToolTip);
    this.invalidate();
}
Also used : BarData(org.xclcharts.chart.BarData) BarPosition(org.xclcharts.event.click.BarPosition) Paint(android.graphics.Paint)

Example 23 with BarData

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

the class StackBarChart01View method chartDataSet.

private void chartDataSet() {
    // 标签1对应的柱形数据集
    List<Double> dataSeriesA = new LinkedList<Double>();
    dataSeriesA.add((double) 212);
    dataSeriesA.add((double) 234);
    dataSeriesA.add(400.123);
    List<Double> dataSeriesB = new LinkedList<Double>();
    dataSeriesB.add((double) 300);
    dataSeriesB.add((double) 150);
    dataSeriesB.add(450.456);
    BarDataSet.add(new BarData("已用空间", dataSeriesA, Color.rgb(0, 0, 255)));
    BarDataSet.add(new BarData("空闲空间", dataSeriesB, Color.rgb(255, 0, 0)));
}
Also used : BarData(org.xclcharts.chart.BarData) LinkedList(java.util.LinkedList)

Example 24 with BarData

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

the class MultiBarChart01View method chartDataSet.

private void chartDataSet() {
    // 标签对应的柱形数据集
    List<Double> dataSeriesA = new LinkedList<Double>();
    dataSeriesA.add(2400d);
    dataSeriesA.add(2400d);
    dataSeriesA.add(2400d);
    dataSeriesA.add(2400d);
    dataSeriesA.add(2400d);
    BarData BarDataA = new BarData("流动资产", dataSeriesA, Color.rgb(58, 191, 247));
    List<Double> dataSeriesB = new LinkedList<Double>();
    dataSeriesB.add(2000d);
    dataSeriesB.add(2000d);
    dataSeriesB.add(2000d);
    dataSeriesB.add(2000d);
    dataSeriesB.add(2000d);
    BarData BarDataB = new BarData("非流动资产", dataSeriesB, Color.rgb(20, 181, 251));
    chartData.add(BarDataA);
    chartData.add(BarDataB);
    List<Double> dataSeriesAA = new LinkedList<Double>();
    dataSeriesAA.add(0d);
    BarData BarDataAA = new BarData("负债", dataSeriesAA, Color.rgb(38, 137, 176));
    List<Double> dataSeriesBB = new LinkedList<Double>();
    dataSeriesBB.add(0d);
    BarData BarDataBB = new BarData("所有者权益", dataSeriesBB, Color.rgb(13, 116, 161));
    chartData.add(BarDataAA);
    chartData.add(BarDataBB);
}
Also used : BarData(org.xclcharts.chart.BarData) LinkedList(java.util.LinkedList)

Example 25 with BarData

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

the class MultiBarChart01View method chartDataSet2.

private void chartDataSet2() {
    // 标签对应的柱形数据集
    List<Double> dataSeriesA = new LinkedList<Double>();
    dataSeriesA.add(1600d);
    dataSeriesA.add(1700d);
    dataSeriesA.add(1800d);
    dataSeriesA.add(1800d);
    dataSeriesA.add(1500d);
    BarData BarDataA = new BarData("负债", dataSeriesA, Color.rgb(38, 137, 176));
    List<Double> dataSeriesB = new LinkedList<Double>();
    dataSeriesB.add(1500d);
    dataSeriesB.add(1300d);
    dataSeriesB.add(1400d);
    dataSeriesB.add(1200d);
    dataSeriesB.add(1600d);
    BarData BarDataB = new BarData("所有者权益", dataSeriesB, Color.rgb(13, 116, 161));
    chartData2.add(BarDataA);
    chartData2.add(BarDataB);
}
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