use of org.xclcharts.chart.ScatterData 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.ScatterData 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.ScatterData in project XCL-Charts by xcltapestry.
the class PlotLegendRender method convertArrayPointKey.
private void convertArrayPointKey(List<ScatterData> dataSet) {
if (null == dataSet)
return;
String key = "";
for (ScatterData cData : dataSet) {
key = cData.getKey();
if (!isDrawKey(key))
continue;
if ("" == key)
continue;
mLstKey.add(key);
mLstColor.add(cData.getPlotDot().getColor());
mLstDotStyle.add(cData.getPlotDot());
}
}
use of org.xclcharts.chart.ScatterData in project XCL-Charts by xcltapestry.
the class ScatterChart01View method chartDataSet.
private void chartDataSet() {
// 线1的数据集
ArrayList<PointD> linePoint1 = new ArrayList<PointD>();
linePoint1.add(new PointD(2d, 10d));
linePoint1.add(new PointD(6d, 10d));
linePoint1.add(new PointD(5d, 10d));
linePoint1.add(new PointD(3d, 10d));
linePoint1.add(new PointD(4d, 10d));
ScatterData dataSeries1 = new ScatterData("青菜萝卜够吃", linePoint1, Color.rgb(54, 141, 238), XEnum.DotStyle.DOT);
dataSeries1.setLabelVisible(true);
dataSeries1.getDotLabelPaint().setColor(Color.rgb(191, 79, 75));
// 线2的数据集
ArrayList<PointD> linePoint2 = new ArrayList<PointD>();
linePoint2.add(new PointD(2d, 5d));
linePoint2.add(new PointD(5d, 5d));
linePoint2.add(new PointD(6d, 5d));
linePoint2.add(new PointD(3d, 5d));
linePoint2.add(new PointD(7d, 5d));
linePoint2.add(new PointD(4d, 5d));
ScatterData dataSeries2 = new ScatterData("饭管够", linePoint2, Color.rgb(155, 187, 90), XEnum.DotStyle.PRISMATIC);
ArrayList<PointD> linePoint3 = new ArrayList<PointD>();
linePoint3.add(new PointD(3d, 20d));
linePoint3.add(new PointD(5d, 20d));
linePoint3.add(new PointD(6d, 20d));
ScatterData dataSeries3 = new ScatterData("哈哈", linePoint3, Color.rgb(54, 141, 238), XEnum.DotStyle.RING);
dataSeries3.setLabelVisible(true);
dataSeries3.getPlotDot().setRingInnerColor(Color.rgb(242, 167, 69));
dataSeries3.getDotLabelPaint().setTextAlign(Align.CENTER);
ArrayList<PointD> linePoint4 = new ArrayList<PointD>();
linePoint4.add(new PointD(2d, 70d));
linePoint4.add(new PointD(3d, 79d));
linePoint4.add(new PointD(5d, 75d));
linePoint4.add(new PointD(7d, 75d));
ScatterData dataSeries4 = new ScatterData("XXX", linePoint4, Color.rgb(60, 173, 213), XEnum.DotStyle.X);
ArrayList<PointD> linePoint5 = new ArrayList<PointD>();
linePoint5.add(new PointD(2d, 40d));
linePoint5.add(new PointD(2d, 50d));
linePoint5.add(new PointD(2d, 60d));
linePoint5.add(new PointD(2.5d, 43d));
linePoint5.add(new PointD(2.5d, 51d));
linePoint5.add(new PointD(2.5d, 60d));
linePoint5.add(new PointD(3d, 73d));
linePoint5.add(new PointD(3d, 40d));
linePoint5.add(new PointD(5d, 55d));
linePoint5.add(new PointD(7d, 55d));
ScatterData dataSeries5 = new ScatterData("Cross", linePoint5, Color.RED, XEnum.DotStyle.CROSS);
// 设定数据源
chartData.add(dataSeries1);
chartData.add(dataSeries2);
chartData.add(dataSeries3);
chartData.add(dataSeries4);
chartData.add(dataSeries5);
}
Aggregations