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();
}
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();
}
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();
}
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();
}
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();
}
Aggregations