use of org.xclcharts.chart.BubbleData 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.BubbleData in project XCL-Charts by xcltapestry.
the class PlotLegendRender method convertArrayBubbleKey.
private void convertArrayBubbleKey(List<BubbleData> dataSet) {
if (null == dataSet)
return;
String key = "";
for (BubbleData cData : dataSet) {
key = cData.getKey();
if (!isDrawKey(key))
continue;
if ("" == key)
continue;
mLstKey.add(key);
mLstColor.add(cData.getColor());
PlotDot pDot = new PlotDot();
pDot.setDotStyle(XEnum.DotStyle.DOT);
mLstDotStyle.add(pDot);
}
}
use of org.xclcharts.chart.BubbleData 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.chart.BubbleData in project XCL-Charts by xcltapestry.
the class BubbleChart01View method chartDataSet.
private void chartDataSet() {
// 线1的数据集
List<PointD> linePoint1 = new ArrayList<PointD>();
linePoint1.add(new PointD(5d, 8d));
linePoint1.add(new PointD(12d, 12d));
linePoint1.add(new PointD(25d, 15d));
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("青菜萝卜够吃", linePoint1, linePoint1_bubble, Color.rgb(54, 141, 238));
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("饭管够", linePoint2, linePoint2_bubble, Color.rgb(255, 165, 132));
// dataSeries2.setBorderColor(Color.BLUE);
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("钱不够花", 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.BubbleData 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
}
Aggregations