Search in sources :

Example 6 with BarData

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

the class BarChart3D01View method triggerClick.

// 触发监听
private void triggerClick(float x, float y) {
    if (!chart.getListenItemClickStatus())
        return;
    BarPosition record = chart.getPositionRecord(x, y);
    if (null == record)
        return;
    BarData bData = BarDataset.get(record.getDataID());
    Double bValue = bData.getDataSet().get(record.getDataChildID());
    // 在点击处显示tooltip
    mPaintToolTip.setColor(Color.WHITE);
    chart.getToolTip().getBackgroundPaint().setColor(Color.rgb(75, 202, 255));
    chart.getToolTip().getBorderPaint().setColor(Color.RED);
    chart.getToolTip().setCurrentXY(x, y);
    chart.getToolTip().addToolTip(" Current Value:" + Double.toString(bValue), mPaintToolTip);
    chart.getToolTip().getBackgroundPaint().setAlpha(100);
    this.invalidate();
}
Also used : BarData(org.xclcharts.chart.BarData) BarPosition(org.xclcharts.event.click.BarPosition)

Example 7 with BarData

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

the class MultiAxisChart01View method chartDatasetLnSet.

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

Example 8 with BarData

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

the class StackBarChart02View method chartDataSet.

private void chartDataSet() {
    // 标签对应的柱形数据集
    List<Double> dataSeriesA = new LinkedList<Double>();
    dataSeriesA.add(200d);
    dataSeriesA.add(550d);
    dataSeriesA.add(400d);
    List<Double> dataSeriesB = new LinkedList<Double>();
    dataSeriesB.add(380d);
    dataSeriesB.add(452.57d);
    dataSeriesB.add(657.65d);
    BarDataSet.add(new BarData("预算(Budget)", dataSeriesA, Color.rgb(64, 175, 240)));
    BarDataSet.add(new BarData("实际(Actual)", dataSeriesB, Color.rgb(247, 156, 27)));
}
Also used : BarData(org.xclcharts.chart.BarData) LinkedList(java.util.LinkedList)

Example 9 with BarData

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

the class BarChart02View 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();
    chart.showFocusRectF(record.getRectF());
    chart.getFocusPaint().setStyle(Style.STROKE);
    chart.getFocusPaint().setStrokeWidth(3);
    chart.getFocusPaint().setColor(Color.GREEN);
    this.invalidate();
}
Also used : BarData(org.xclcharts.chart.BarData) BarPosition(org.xclcharts.event.click.BarPosition)

Example 10 with BarData

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

the class BarChart07View_left method chartDataSet.

private void chartDataSet() {
    // 标签对应的柱形数据集
    List<Double> dataSeriesA = new LinkedList<Double>();
    // 依数据值确定对应的柱形颜色.
    List<Integer> dataColorA = new LinkedList<Integer>();
    dataSeriesA.add(0d);
    dataColorA.add(Color.RED);
    // 此地的颜色为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)

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