use of org.xclcharts.chart.AreaData 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.chart.AreaData 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.chart.AreaData 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.chart.AreaData in project XCL-Charts by xcltapestry.
the class MultiAxisChart03View method chartDataSet.
private void chartDataSet() {
List<Double> dataSeries2 = new LinkedList<Double>();
//40
dataSeries2.add((double) 140);
dataSeries2.add((double) 122);
dataSeries2.add((double) 130);
dataSeries2.add((double) 135);
//15
dataSeries2.add((double) 115);
AreaData line2 = new AreaData("小小熊", dataSeries2, Color.RED, //(int)Color.rgb(254, 170, 50)
Color.YELLOW);
//设置线上每点对应标签的颜色
line2.getDotLabelPaint().setColor(Color.rgb(83, 148, 235));
//设置点标签
line2.setLabelVisible(true);
line2.getLabelOptions().setLabelBoxStyle(XEnum.LabelBoxStyle.CAPRECT);
line2.getLabelOptions().setOffsetY(20.f);
line2.setApplayGradient(true);
line2.setGradientMode(Shader.TileMode.MIRROR);
//Color.rgb(254, 170, 50));
line2.setAreaBeginColor(Color.WHITE);
line2.setAreaEndColor(Color.rgb(224, 65, 10));
line2.setDotStyle(XEnum.DotStyle.RING);
line2.getPlotLine().getDotPaint().setColor(Color.WHITE);
line2.getPlotLine().getPlotDot().setRingInnerColor(Color.RED);
mDataset.add(line2);
}
use of org.xclcharts.chart.AreaData in project XCL-Charts by xcltapestry.
the class AreaChart01View method chartDataSet.
private void chartDataSet() {
//将标签与对应的数据集分别绑定
//标签对应的数据集
List<Double> dataSeries1 = new LinkedList<Double>();
//55
dataSeries1.add(0d);
dataSeries1.add((double) 60);
dataSeries1.add((double) 71);
dataSeries1.add((double) 40);
dataSeries1.add((double) 35);
List<Double> dataSeries2 = new LinkedList<Double>();
dataSeries2.add((double) 10);
dataSeries2.add((double) 22);
dataSeries2.add((double) 30);
//30
dataSeries2.add((double) 30);
//15
dataSeries2.add((double) 0);
List<Double> dataSeries3 = new LinkedList<Double>();
dataSeries3.add((double) 35);
dataSeries3.add((double) 45);
dataSeries3.add((double) 65);
dataSeries3.add((double) 75);
dataSeries3.add((double) 55);
//设置每条线各自的显示属性
//key,数据集,线颜色,区域颜色
AreaData line1 = new AreaData("小熊", dataSeries1, Color.BLUE, Color.YELLOW);
//不显示点
line1.setDotStyle(XEnum.DotStyle.HIDE);
/*
line1.setApplayGradient(true);
line1.setAreaBeginColor(Color.WHITE);
line1.setAreaEndColor(Color.YELLOW);
*/
AreaData line2 = new AreaData("小小熊", dataSeries2, Color.rgb(79, 200, 100), Color.GREEN);
//设置线上每点对应标签的颜色
line2.getDotLabelPaint().setColor(Color.RED);
//设置点标签
line2.setLabelVisible(true);
line2.getLabelOptions().setLabelBoxStyle(XEnum.LabelBoxStyle.RECT);
line2.getLabelOptions().getBox().getBackgroundPaint().setColor(Color.rgb(250, 194, 142));
AreaData line3 = new AreaData("小小小熊", dataSeries3, Color.rgb(246, 134, 31), Color.rgb(213, 198, 126));
//设置线上每点对应标签的颜色
//line3.getDotLabelPaint().setColor(Color.YELLOW);
line3.setLineStyle(XEnum.LineStyle.DOT);
mDataset.add(line1);
mDataset.add(line3);
mDataset.add(line2);
}
Aggregations