use of org.xclcharts.event.click.PointPosition in project XCL-Charts by xcltapestry.
the class LineChart01View method triggerClick.
//触发监听
private void triggerClick(float x, float y) {
//交叉线
if (chart.getDyLineVisible())
chart.getDyLine().setCurrentXY(x, y);
if (!chart.getListenItemClickStatus()) {
//交叉线
if (chart.getDyLineVisible())
this.invalidate();
} else {
PointPosition record = chart.getPositionRecord(x, y);
if (null == record) {
if (chart.getDyLineVisible())
this.invalidate();
return;
}
LineData lData = chartData.get(record.getDataID());
Double lValue = lData.getLinePoint().get(record.getDataChildID());
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.BLUE);
} else {
chart.getFocusPaint().setColor(Color.RED);
}
//在点击处显示tooltip
mPaintTooltips.setColor(Color.RED);
//chart.getToolTip().setCurrentXY(x,y);
chart.getToolTip().setCurrentXY(record.getPosition().x, record.getPosition().y);
chart.getToolTip().addToolTip(" Key:" + lData.getLineKey(), mPaintTooltips);
chart.getToolTip().addToolTip(" Label:" + lData.getLabel(), mPaintTooltips);
chart.getToolTip().addToolTip(" Current Value:" + Double.toString(lValue), mPaintTooltips);
//当前标签对应的其它点的值
int cid = record.getDataChildID();
String xLabels = "";
for (LineData data : chartData) {
if (cid < data.getLinePoint().size()) {
xLabels = Double.toString(data.getLinePoint().get(cid));
chart.getToolTip().addToolTip("Line:" + data.getLabel() + "," + xLabels, mPaintTooltips);
}
}
this.invalidate();
}
}
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 MultiAxisChart03View 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());
//在点击处显示tooltip
mPaintTooltips.setColor(Color.rgb(240, 73, 119));
chart.getToolTip().getBackgroundPaint().setColor(Color.GREEN);
chart.getToolTip().setCurrentXY(x, y);
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.LEFT);
this.invalidate();
}
use of org.xclcharts.event.click.PointPosition in project XCL-Charts by xcltapestry.
the class SplineChart05View 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.getFocusPaint().setStyle(Style.FILL);
chart.getFocusPaint().setStrokeWidth(6);
chart.getFocusPaint().setColor(Color.rgb(237, 92, 92));
chart.showFocusPointF(record.getPosition(), r * 2);
/*
//在点击处显示tooltip
pToolTip.setColor(Color.RED);
pToolTip.setStrokeWidth(3);
chart.getToolTip().setCurrentXY(x,y);
//chart.getToolTip().setRoundRadius(x, y);
chart.getToolTip().setStyle(XEnum.DyInfoStyle.CIRCLE);
chart.getToolTip().addToolTip("",pToolTip);
*/
this.invalidate();
break;
}
i++;
}
//end while
}
}
Aggregations