use of org.xclcharts.chart.PointD in project XCL-Charts by xcltapestry.
the class QuadrantChart01View method chartDataSetScat.
private void chartDataSetScat() {
// 线1的数据集
List<PointD> linePoint1 = new ArrayList<PointD>();
linePoint1.add(new PointD(15d, 68d));
linePoint1.add(new PointD(32d, 62d));
linePoint1.add(new PointD(25d, 55d));
linePoint1.add(new PointD(60d, 80d));
ScatterData dataSeries1 = new ScatterData("散点1", linePoint1, Color.rgb(41, 161, 64), XEnum.DotStyle.DOT);
dataSeries1.setLabelVisible(true);
dataSeries1.getDotLabelPaint().setColor(Color.rgb(41, 161, 64));
// 线2的数据集
List<PointD> linePoint2 = new ArrayList<PointD>();
linePoint2.add(new PointD(43d, 70d));
linePoint2.add(new PointD(56d, 85d));
linePoint2.add(new PointD(37d, 65d));
ScatterData dataSeries2 = new ScatterData("散点2", linePoint2, Color.YELLOW, XEnum.DotStyle.PRISMATIC);
// 设定数据源
chartDataScat.add(dataSeries1);
chartDataScat.add(dataSeries2);
}
use of org.xclcharts.chart.PointD in project XCL-Charts by xcltapestry.
the class QuadrantChart01View method chartDataSetSp.
private void chartDataSetSp() {
// 线1的数据集
List<PointD> linePoint1 = new ArrayList<PointD>();
linePoint1.add(new PointD(25d, 15d));
linePoint1.add(new PointD(45d, 35d));
linePoint1.add(new PointD(50d, 40d));
linePoint1.add(new PointD(65d, 45d));
linePoint1.add(new PointD(70d, 50d));
linePoint1.add(new PointD(75d, 65d));
linePoint1.add(new PointD(85d, 73d));
linePoint1.add(new PointD(92d, 85d));
SplineData dataSeries1 = new SplineData("指向线", linePoint1, // (int)Color.rgb(54, 141, 238)
Color.RED);
// 把线弄细点
dataSeries1.getLinePaint().setStrokeWidth(10);
dataSeries1.setDotStyle(XEnum.DotStyle.HIDE);
// 设定数据源
chartDataSp.add(dataSeries1);
}
use of org.xclcharts.chart.PointD in project XCL-Charts by xcltapestry.
the class QuadrantChart01View method chartDataSet.
private void chartDataSet() {
// 线1的数据集
List<PointD> linePoint1 = new ArrayList<PointD>();
linePoint1.add(new PointD(30d, 30d));
linePoint1.add(new PointD(45d, 25d));
linePoint1.add(new PointD(55d, 33d));
linePoint1.add(new PointD(62d, 45d));
// 气泡大小
ArrayList<Double> linePoint1_bubble = new ArrayList<Double>();
linePoint1_bubble.add(55d);
linePoint1_bubble.add(60d);
linePoint1_bubble.add(65d);
linePoint1_bubble.add(95d);
linePoint1_bubble.add(75d);
linePoint1_bubble.add(78d);
BubbleData dataSeries1 = new BubbleData("气泡1", linePoint1, linePoint1_bubble, Color.rgb(72, 117, 14));
dataSeries1.setLabelVisible(true);
dataSeries1.getDotLabelPaint().setTextAlign(Align.CENTER);
dataSeries1.setBorderColor(Color.RED);
// 线2的数据集
List<PointD> linePoint2 = new ArrayList<PointD>();
linePoint2.add(new PointD(40d, 50d));
linePoint2.add(new PointD(55d, 55d));
linePoint2.add(new PointD(60d, 65d));
linePoint2.add(new PointD(65d, 85d));
linePoint2.add(new PointD(72d, 70d));
linePoint2.add(new PointD(85d, 68d));
ArrayList<Double> linePoint2_bubble = new ArrayList<Double>();
linePoint2_bubble.add(55d);
linePoint2_bubble.add(60d);
linePoint2_bubble.add(65d);
linePoint2_bubble.add(95d);
linePoint2_bubble.add(75d);
linePoint2_bubble.add(78d);
BubbleData dataSeries2 = new BubbleData("气泡2", linePoint2, linePoint2_bubble, Color.rgb(59, 59, 59));
dataSeries2.setLabelVisible(true);
// dataSeries2.setDotStyle(XEnum.DotStyle.RECT);
dataSeries2.getDotLabelPaint().setColor(Color.rgb(69, 199, 101));
dataSeries2.setItemLabelRotateAngle(45.f);
List<PointD> linePoint3 = new ArrayList<PointD>();
linePoint3.add(new PointD(10d, 70d));
linePoint3.add(new PointD(25d, 85d));
linePoint3.add(new PointD(30d, 95d));
ArrayList<Double> linePoint3_bubble = new ArrayList<Double>();
linePoint3_bubble.add(55d);
linePoint3_bubble.add(60d);
linePoint3_bubble.add(65d);
BubbleData dataSeries3 = new BubbleData("气泡3", linePoint2, linePoint3_bubble, Color.rgb(247, 178, 79));
dataSeries3.setBorderColor(Color.rgb(47, 254, 225));
// 设定数据源
chartData.add(dataSeries1);
chartData.add(dataSeries2);
chartData.add(dataSeries3);
}
use of org.xclcharts.chart.PointD 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.chart.PointD 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