Search in sources :

Example 1 with PointD

use of org.xclcharts.chart.PointD in project XCL-Charts by xcltapestry.

the class MultiAxisChart03View method chartDataSetAxes.

private void chartDataSetAxes() {
    //线1的数据集
    List<PointD> linePoint1 = new ArrayList<PointD>();
    linePoint1.add(new PointD(0d, 0d));
    SplineData dataSeries1 = new SplineData("", linePoint1, Color.rgb(54, 141, 238));
    dataSeries1.setDotStyle(XEnum.DotStyle.HIDE);
    //设定数据源		
    chartDataAxes.add(dataSeries1);
}
Also used : PointD(org.xclcharts.chart.PointD) ArrayList(java.util.ArrayList) SplineData(org.xclcharts.chart.SplineData)

Example 2 with PointD

use of org.xclcharts.chart.PointD in project XCL-Charts by xcltapestry.

the class SplineChart05View method chartDataSet.

private void chartDataSet() {
    //线1的数据集
    List<PointD> linePoint1 = new ArrayList<PointD>();
    linePoint1.add(new PointD(0d, 3d));
    linePoint1.add(new PointD(1d, 9d));
    linePoint1.add(new PointD(2d, 8d));
    linePoint1.add(new PointD(3d, 7d));
    linePoint1.add(new PointD(4d, 15d));
    linePoint1.add(new PointD(5d, 16d));
    SplineData dataSeries1 = new SplineData("Go", linePoint1, //Color.rgb(54, 141, 238)
    Color.WHITE);
    //把线弄细点
    dataSeries1.getLinePaint().setStrokeWidth(6);
    dataSeries1.setLineStyle(XEnum.LineStyle.DASH);
    dataSeries1.setLabelVisible(false);
    dataSeries1.setDotStyle(XEnum.DotStyle.RING);
    dataSeries1.getDotPaint().setColor(Color.rgb(30, 179, 143));
    //
    dataSeries1.getPlotLine().getPlotDot().setRingInnerColor(Color.WHITE);
    chartData.add(dataSeries1);
}
Also used : PointD(org.xclcharts.chart.PointD) ArrayList(java.util.ArrayList) SplineData(org.xclcharts.chart.SplineData)

Example 3 with PointD

use of org.xclcharts.chart.PointD in project XCL-Charts by xcltapestry.

the class SplineChart05View 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;
        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;	
                float r = record.getRadius();
                chart.getFocusPaint().setStyle(Style.FILL);
                chart.getFocusPaint().setStrokeWidth(6);
                chart.getFocusPaint().setColor(Color.rgb(237, 92, 92));
                chart.showFocusPointF(record.getPosition(), r * 2);
                /*
						//在点击处显示tooltip
						pToolTip.setColor(Color.RED);	
						pToolTip.setStrokeWidth(3);
						chart.getToolTip().setCurrentXY(x,y);
						//chart.getToolTip().setRoundRadius(x, y);
						chart.getToolTip().setStyle(XEnum.DyInfoStyle.CIRCLE);
						chart.getToolTip().addToolTip("",pToolTip);
						*/
                this.invalidate();
                break;
            }
            i++;
        }
    //end while
    }
}
Also used : PointD(org.xclcharts.chart.PointD) Iterator(java.util.Iterator) SplineData(org.xclcharts.chart.SplineData) PointPosition(org.xclcharts.event.click.PointPosition) Paint(android.graphics.Paint) AnchorDataPoint(org.xclcharts.renderer.info.AnchorDataPoint)

Example 4 with PointD

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
}
Also used : PointD(org.xclcharts.chart.PointD) Iterator(java.util.Iterator) SplineData(org.xclcharts.chart.SplineData) PointPosition(org.xclcharts.event.click.PointPosition)

Example 5 with PointD

use of org.xclcharts.chart.PointD in project XCL-Charts by xcltapestry.

the class SplineChart03View 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;
            float r = record.getRadius();
            chart.showFocusPointF(record.getPosition(), r + r * 0.8f);
            chart.getFocusPaint().setStyle(Style.FILL);
            chart.getFocusPaint().setStrokeWidth(3);
            if (record.getDataID() >= 2) {
                chart.getFocusPaint().setColor(Color.BLUE);
            } else {
                chart.getFocusPaint().setColor(Color.RED);
            }
            //在点击处显示tooltip
            mPaintTooltips.setColor(Color.RED);
            chart.getToolTip().setCurrentXY(x, y);
            chart.getToolTip().addToolTip(" Key:" + lData.getLineKey(), mPaintTooltips);
            chart.getToolTip().addToolTip(" Current Value:" + Double.toString(xValue) + "," + Double.toString(yValue), mPaintTooltips);
            chart.getToolTip().getBackgroundPaint().setAlpha(100);
            this.invalidate();
            break;
        }
        i++;
    }
//end while
}
Also used : PointD(org.xclcharts.chart.PointD) Iterator(java.util.Iterator) SplineData(org.xclcharts.chart.SplineData) PointPosition(org.xclcharts.event.click.PointPosition) Paint(android.graphics.Paint)

Aggregations

PointD (org.xclcharts.chart.PointD)19 ArrayList (java.util.ArrayList)11 SplineData (org.xclcharts.chart.SplineData)11 Iterator (java.util.Iterator)7 PointPosition (org.xclcharts.event.click.PointPosition)7 Paint (android.graphics.Paint)5 BubbleData (org.xclcharts.chart.BubbleData)4 ScatterData (org.xclcharts.chart.ScatterData)3 AnchorDataPoint (org.xclcharts.renderer.info.AnchorDataPoint)2 DySplineChart (com.demo.xclcharts.view.DySplineChart)1 Random (java.util.Random)1