use of org.xclcharts.event.click.PointPosition in project XCL-Charts by xcltapestry.
the class QuadrantChart01View 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;
BubbleData lData = chartData.get(record.getDataID());
List<PointD> mapPoint = lData.getDataSet();
int pos = record.getDataChildID();
int i = 0;
Iterator it = mapPoint.iterator();
while (it.hasNext()) {
PointD entry = (PointD) it.next();
if (pos == i) {
Double xValue = entry.x;
Double yValue = entry.y;
float r = record.getRadius();
chart.showFocusPointF(record.getPosition(), r + r * 0.5f);
chart.getFocusPaint().setStyle(Style.STROKE);
chart.getFocusPaint().setStrokeWidth(3);
if (record.getDataID() >= 3) {
chart.getFocusPaint().setColor(Color.WHITE);
} else {
chart.getFocusPaint().setColor(Color.RED);
}
this.invalidate();
break;
}
i++;
}
// end while
}
// end if
}
use of org.xclcharts.event.click.PointPosition in project XCL-Charts by xcltapestry.
the class BubbleChart01View 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;
BubbleData lData = chartData.get(record.getDataID());
List<PointD> mapPoint = lData.getDataSet();
int pos = record.getDataChildID();
int i = 0;
Iterator it = mapPoint.iterator();
while (it.hasNext()) {
PointD entry = (PointD) it.next();
if (pos == i) {
Double xValue = entry.x;
Double yValue = entry.y;
float r = record.getRadius();
chart.showFocusPointF(record.getPosition(), r + r * 0.5f);
chart.getFocusPaint().setStyle(Style.STROKE);
chart.getFocusPaint().setStrokeWidth(3);
if (record.getDataID() >= 3) {
chart.getFocusPaint().setColor(Color.WHITE);
} else {
chart.getFocusPaint().setColor(Color.RED);
}
// 在点击处显示tooltip
mPaintTooltips.setColor(Color.WHITE);
chart.getToolTip().setCurrentXY(record.getPosition().x, record.getPosition().y);
chart.getToolTip().addToolTip(" Key:" + lData.getKey(), mPaintTooltips);
chart.getToolTip().addToolTip(Double.toString(xValue) + "," + Double.toString(yValue), mPaintTooltips);
chart.getToolTip().setStyle(XEnum.DyInfoStyle.CAPRECT);
chart.getToolTip().setAlign(Align.CENTER);
chart.getToolTip().getBackgroundPaint().setColor(Color.parseColor("#9400D3"));
this.invalidate();
break;
}
i++;
}
// end while
}
// end if
}
use of org.xclcharts.event.click.PointPosition in project XCL-Charts by xcltapestry.
the class SplineChart01View 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;
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;
float r = record.getRadius();
chart.showFocusPointF(record.getPosition(), r * 2);
chart.getFocusPaint().setStyle(Style.STROKE);
chart.getFocusPaint().setStrokeWidth(3);
if (record.getDataID() >= 2) {
chart.getFocusPaint().setColor(Color.BLUE);
} else {
chart.getFocusPaint().setColor(Color.RED);
}
// 在点击处显示tooltip
pToolTip.setColor(Color.RED);
chart.getToolTip().setCurrentXY(x, y);
chart.getToolTip().addToolTip(" Key:" + lData.getLineKey(), pToolTip);
chart.getToolTip().addToolTip(" Label:" + lData.getLabel(), pToolTip);
chart.getToolTip().addToolTip(" Current Value:" + Double.toString(xValue) + "," + Double.toString(yValue), pToolTip);
chart.getToolTip().getBackgroundPaint().setAlpha(100);
this.invalidate();
break;
}
i++;
}
// end while
}
}
Aggregations