use of org.xclcharts.event.click.PointPosition in project XCL-Charts by xcltapestry.
the class AreaChart01View method triggerClick.
// 触发监听
private void triggerClick(float x, float y) {
PointPosition record = chart.getPositionRecord(x, y);
if (null == record)
return;
AreaData lData = mDataset.get(record.getDataID());
Double lValue = lData.getLinePoint().get(record.getDataChildID());
/*
Toast.makeText(this.getContext(),
record.getPointInfo() +
" Key:"+lData.getLineKey() +
" Label:"+lData.getLabel() +
" Current Value:"+Double.toString(lValue),
Toast.LENGTH_SHORT).show();
*/
float r = record.getRadius();
chart.showFocusPointF(record.getPosition(), r + r * 0.5f);
// chart.getFocusPaint().setStyle(Style.STROKE);
chart.getFocusPaint().setStrokeWidth(3);
chart.getFocusPaint().setColor(Color.RED);
chart.getFocusPaint().setTextAlign(Align.CENTER);
// 在点击处显示tooltip
mPaintTooltips.setColor(Color.YELLOW);
chart.getToolTip().getBackgroundPaint().setColor(Color.GRAY);
// chart.getToolTip().setCurrentXY(x,y);
chart.getToolTip().setCurrentXY(record.getPosition().x, record.getPosition().y);
chart.getToolTip().setStyle(XEnum.DyInfoStyle.CAPRECT);
chart.getToolTip().addToolTip(" Key:" + lData.getLineKey(), mPaintTooltips);
chart.getToolTip().addToolTip(" Label:" + lData.getLabel(), mPaintTooltips);
chart.getToolTip().addToolTip(" Current Value:" + Double.toString(lValue), mPaintTooltips);
chart.getToolTip().setAlign(Align.CENTER);
this.invalidate();
}
use of org.xclcharts.event.click.PointPosition in project XCL-Charts by xcltapestry.
the class AreaChart02View method triggerClick.
// 触发监听
private void triggerClick(float x, float y) {
PointPosition record = chart.getPositionRecord(x, y);
if (null == record)
return;
AreaData lData = mDataset.get(record.getDataID());
Double lValue = lData.getLinePoint().get(record.getDataChildID());
Toast.makeText(this.getContext(), record.getPointInfo() + " Key:" + lData.getLineKey() + " Label:" + lData.getLabel() + " Current Value:" + Double.toString(lValue), Toast.LENGTH_SHORT).show();
}
use of org.xclcharts.event.click.PointPosition in project XCL-Charts by xcltapestry.
the class RadarChart02View method triggerClick.
// 触发监听
private void triggerClick(float x, float y) {
PointPosition record = chart.getPositionRecord(x, y);
if (null == record)
return;
if (record.getDataID() < chartData.size()) {
RadarData lData = chartData.get(record.getDataID());
Double lValue = lData.getLinePoint().get(record.getDataChildID());
Toast.makeText(this.getContext(), " Current Value:" + Double.toString(lValue) + " Point info:" + record.getPointInfo(), Toast.LENGTH_SHORT).show();
}
}
use of org.xclcharts.event.click.PointPosition in project XCL-Charts by xcltapestry.
the class ScatterChart01View method triggerClick.
// 触发监听
private void triggerClick(float x, float y) {
// 交叉线
if (chart.getDyLineVisible())
chart.getDyLine().setCurrentXY(x, y);
if (!chart.getListenItemClickStatus()) {
if (chart.getDyLineVisible() && chart.getDyLine().isInvalidate())
this.invalidate();
} else {
PointPosition record = chart.getPositionRecord(x, y);
if (null == record)
return;
ScatterData lData = chartData.get(record.getDataID());
List<PointD> linePoint = lData.getDataSet();
int pos = record.getDataChildID();
int i = 0;
Iterator it = linePoint.iterator();
while (it.hasNext()) {
PointD entry = (PointD) it.next();
if (pos == i) {
Double xValue = entry.x;
Double yValue = entry.y;
// 在点击处显示tooltip
mPaintTooltips.setColor(Color.RED);
chart.getToolTip().setCurrentXY(x, y);
chart.getToolTip().addToolTip(" Key:" + lData.getKey(), mPaintTooltips);
chart.getToolTip().addToolTip(" Current Value:" + Double.toString(xValue) + "," + Double.toString(yValue), mPaintTooltips);
this.invalidate();
break;
}
i++;
}
// end while
}
// end if
}
use of org.xclcharts.event.click.PointPosition in project XCL-Charts by xcltapestry.
the class SplineChart02View method triggerClick.
// 触发监听
private void triggerClick(float x, float y) {
if (!chart.getListenItemClickStatus())
return;
PointPosition record = chart.getPositionRecord(x, y);
if (null == record)
return;
if (record.getDataID() >= chartData.size())
return;
SplineData lData = chartData.get(record.getDataID());
List<PointD> linePoint = lData.getLineDataSet();
int pos = record.getDataChildID();
int i = 0;
Iterator it = linePoint.iterator();
while (it.hasNext()) {
PointD entry = (PointD) it.next();
if (pos == i) {
Double xValue = entry.x;
Double yValue = entry.y;
Toast.makeText(this.getContext(), record.getPointInfo() + " Key:" + lData.getLineKey() + " Current Value(key,value):" + Double.toString(xValue) + "," + Double.toString(yValue), Toast.LENGTH_SHORT).show();
break;
}
i++;
}
// end while
}
Aggregations