Search in sources :

Example 1 with BarPosition

use of org.xclcharts.event.click.BarPosition in project XCL-Charts by xcltapestry.

the class BarChart10View 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 2 with BarPosition

use of org.xclcharts.event.click.BarPosition 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 3 with BarPosition

use of org.xclcharts.event.click.BarPosition 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 4 with BarPosition

use of org.xclcharts.event.click.BarPosition 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)

Example 5 with BarPosition

use of org.xclcharts.event.click.BarPosition 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)

Aggregations

BarPosition (org.xclcharts.event.click.BarPosition)10 BarData (org.xclcharts.chart.BarData)9 Paint (android.graphics.Paint)1