use of org.xclcharts.chart.LineData in project XCL-Charts by xcltapestry.
the class MultiAxisChart02View method chartLnDataSet.
private void chartLnDataSet() {
// 标签1对应的数据集
LinkedList<Double> virtual = new LinkedList<Double>();
// virtual.add(0d);
virtual.add(95d);
virtual.add(100d);
// virtual.add(0d);
// 标签2对应的数据集
LinkedList<Double> physical = new LinkedList<Double>();
// physical.add(0d);
physical.add(110d);
physical.add(125d);
// physical.add(0d);
// 将标签与对应的数据集分别绑定
LineData lineData1 = new LineData("Virtual RT", virtual, Color.rgb(234, 83, 71));
LineData lineData2 = new LineData("Physical RT", physical, Color.rgb(75, 166, 51));
lineData1.setDotStyle(XEnum.DotStyle.TRIANGLE);
lineData1.getDotPaint().setColor(Color.rgb(234, 83, 71));
LinkedList<Double> BarKey1 = new LinkedList<Double>();
BarKey1.add(0d);
LinkedList<Double> BarKey2 = new LinkedList<Double>();
BarKey2.add(0d);
LineData lineDataBarKey1 = new LineData("Virtual OPM", BarKey1, Color.rgb(0, 221, 177));
LineData lineDataBarKey2 = new LineData("Physical OPM", BarKey2, Color.rgb(238, 28, 161));
lineDataBarKey1.setDotStyle(XEnum.DotStyle.RECT);
lineDataBarKey2.setDotStyle(XEnum.DotStyle.RECT);
chartDataLn.add(lineDataBarKey1);
chartDataLn.add(lineDataBarKey2);
chartDataLn.add(lineData1);
chartDataLn.add(lineData2);
}
use of org.xclcharts.chart.LineData in project XCL-Charts by xcltapestry.
the class LineChart02View method chartAnimation.
private void chartAnimation() {
try {
int count = chartData.size();
for (int i = 0; i < count; i++) {
Thread.sleep(150);
LinkedList<LineData> animationData = new LinkedList<LineData>();
for (int j = 0; j <= i; j++) {
animationData.add(chartData.get(j));
}
// Log.e(TAG,"size = "+animationData.size());
chart.setDataSource(animationData);
if (i == count - 1) {
chart.getDataAxis().show();
chart.getDataAxis().showAxisLabels();
chart.setCustomLines(mCustomLineDataset);
}
postInvalidate();
}
} catch (Exception e) {
Thread.currentThread().interrupt();
}
}
use of org.xclcharts.chart.LineData in project XCL-Charts by xcltapestry.
the class LineChart02View method chartDataSet.
private void chartDataSet() {
// Line 1
LinkedList<Double> dataSeries1 = new LinkedList<Double>();
dataSeries1.add(400d);
dataSeries1.add(480d);
dataSeries1.add(500d);
dataSeries1.add(560d);
LineData lineData1 = new LineData("单间(5层光线好)", dataSeries1, Color.rgb(234, 83, 71));
lineData1.setDotStyle(XEnum.DotStyle.DOT);
// Line 2
LinkedList<Double> dataSeries2 = new LinkedList<Double>();
dataSeries2.add(0d);
dataSeries2.add(0d);
dataSeries2.add(0d);
dataSeries2.add(0d);
dataSeries2.add((double) 800);
dataSeries2.add((double) 950);
dataSeries2.add((double) 1200);
LineData lineData2 = new LineData("一房一厅(3层无光线)", dataSeries2, Color.rgb(75, 166, 51));
lineData2.setDotStyle(XEnum.DotStyle.PRISMATIC);
lineData2.getPlotLine().getDotPaint().setColor(Color.rgb(234, 142, 43));
lineData2.getDotLabelPaint().setColor(Color.rgb(234, 142, 43));
lineData2.setLabelVisible(true);
lineData2.getLabelOptions().getBox().getBackgroundPaint().setColor(Color.rgb(76, 76, 76));
// lineData2.getPlotLabel().hideBox();
// Line 3
LinkedList<Double> dataSeries3 = new LinkedList<Double>();
dataSeries3.add(0d);
dataSeries3.add(0d);
dataSeries3.add(0d);
dataSeries3.add(0d);
dataSeries3.add(0d);
dataSeries3.add(0d);
dataSeries3.add(0d);
dataSeries3.add(630d);
dataSeries3.add(710d);
LineData lineData3 = new LineData("单间(9层无电梯)", dataSeries3, Color.rgb(123, 89, 168));
lineData3.setDotStyle(XEnum.DotStyle.DOT);
// 轴上分界线的交叉点
LinkedList<Double> dataSeries4 = new LinkedList<Double>();
dataSeries4.add(1500d);
LinkedList<Double> dataSeries5 = new LinkedList<Double>();
dataSeries5.add(3000d);
LinkedList<Double> dataSeries6 = new LinkedList<Double>();
dataSeries6.add(calcAvg());
LineData lineData4 = new LineData("", dataSeries4, Color.rgb(35, 172, 57));
lineData4.setDotStyle(XEnum.DotStyle.RECT);
LineData lineData5 = new LineData("", dataSeries5, Color.rgb(69, 181, 248));
lineData5.setDotStyle(XEnum.DotStyle.RECT);
LineData lineData6 = new LineData("", dataSeries6, Color.rgb(251, 79, 128));
lineData6.setDotStyle(XEnum.DotStyle.TRIANGLE);
chartData.add(lineData1);
chartData.add(lineData2);
chartData.add(lineData3);
chartData.add(lineData4);
chartData.add(lineData5);
chartData.add(lineData6);
// 批注
// List<AnchorDataPoint> mAnchorSet = new ArrayList<AnchorDataPoint>();
AnchorDataPoint an4 = new AnchorDataPoint(0, 2, XEnum.AnchorStyle.CAPRECT);
an4.setAnchor("批注");
an4.setBgColor(Color.rgb(255, 145, 126));
mAnchorSet.add(an4);
chart.setAnchorDataPoint(mAnchorSet);
}
use of org.xclcharts.chart.LineData in project XCL-Charts by xcltapestry.
the class MultiAxisChart03View method chartDataSetLn.
private void chartDataSetLn() {
LinkedList<Double> dataSeries0 = new LinkedList<Double>();
dataSeries0.add(0d);
// (int)Color.rgb(48, 145, 255));
LineData line2 = new LineData("Area圆环", dataSeries0, Color.rgb(224, 65, 10));
line2.setDotStyle(XEnum.DotStyle.RING);
line2.getPlotLine().getDotPaint().setColor(Color.WHITE);
line2.getPlotLine().getPlotDot().setRingInnerColor(Color.RED);
// line2.getLabelOptions().hideBox();
// Line 1
LinkedList<Double> dataSeries1 = new LinkedList<Double>();
dataSeries1.add(40d);
dataSeries1.add(35d);
dataSeries1.add(50d);
dataSeries1.add(60d);
dataSeries1.add(55d);
LineData lineData1 = new LineData("直线", dataSeries1, Color.rgb(106, 218, 92));
lineData1.setLabelVisible(true);
lineData1.setDotStyle(XEnum.DotStyle.HIDE);
lineData1.getDotLabelPaint().setColor(Color.BLUE);
lineData1.getDotLabelPaint().setTextSize(22);
lineData1.getDotLabelPaint().setTextAlign(Align.LEFT);
lineData1.setItemLabelRotateAngle(45.f);
lineData1.getLabelOptions().setLabelBoxStyle(XEnum.LabelBoxStyle.RECT);
// Line 2
LinkedList<Double> dataSeries2 = new LinkedList<Double>();
dataSeries2.add((double) 50);
dataSeries2.add((double) 42);
dataSeries2.add((double) 55);
dataSeries2.add((double) 65);
dataSeries2.add((double) 58);
LineData lineData2 = new LineData("圆环", dataSeries2, Color.rgb(48, 145, 255));
lineData2.setDotStyle(XEnum.DotStyle.RING);
lineData2.getPlotLine().getDotPaint().setColor(Color.RED);
lineData2.setLabelVisible(true);
lineData2.getPlotLine().getPlotDot().setRingInnerColor(Color.GREEN);
lineData2.getLabelOptions().setLabelBoxStyle(XEnum.LabelBoxStyle.CAPRECT);
// lineData2.setLineStyle(XEnum.LineStyle.DASH);
LinkedList<Double> dataSeries3 = new LinkedList<Double>();
dataSeries3.add((double) 55);
dataSeries3.add((double) 42);
dataSeries3.add((double) 65);
dataSeries3.add((double) 45);
LineData lineData3 = new LineData("角", dataSeries3, Color.rgb(199, 64, 219));
lineData3.setDotStyle(XEnum.DotStyle.TRIANGLE);
lineData3.getLabelOptions().setLabelBoxStyle(XEnum.LabelBoxStyle.TEXT);
chartData.add(line2);
chartData.add(lineData1);
chartData.add(lineData2);
chartData.add(lineData3);
}
Aggregations