Search in sources :

Example 1 with RadarData

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

the class RadarChart01View method triggerClick.

//触发监听
private void triggerClick(float x, float y) {
    PointPosition record = chart.getPositionRecord(x, y);
    if (null == record)
        return;
    if (record.getDataID() < chartData.size()) {
        RadarData lData = chartData.get(record.getDataID());
        Double lValue = lData.getLinePoint().get(record.getDataChildID());
        float r = record.getRadius();
        chart.showFocusPointF(record.getPosition(), r + r * 0.5f);
        chart.getFocusPaint().setStyle(Style.STROKE);
        chart.getFocusPaint().setStrokeWidth(3);
        chart.getFocusPaint().setColor(Color.YELLOW);
        //在点击处显示tooltip
        mPaintTooltips.setColor(Color.RED);
        chart.getToolTip().setCurrentXY(x, y);
        chart.getToolTip().addToolTip(" 点击", mPaintTooltips);
        chart.getToolTip().addToolTip(" Current Value:" + Double.toString(lValue), mPaintTooltips);
        this.invalidate();
    }
}
Also used : RadarData(org.xclcharts.chart.RadarData) PointPosition(org.xclcharts.event.click.PointPosition)

Example 2 with RadarData

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

the class RadarChart01View method chartDataSet.

private void chartDataSet() {
    LinkedList<Double> dataSeriesA = new LinkedList<Double>();
    //20d
    dataSeriesA.add(0d);
    dataSeriesA.add(10d);
    dataSeriesA.add(30d);
    dataSeriesA.add(25d);
    dataSeriesA.add(20d);
    RadarData lineData1 = new RadarData("现状", dataSeriesA, Color.rgb(234, 83, 71), XEnum.DataAreaStyle.FILL);
    lineData1.setLabelVisible(true);
    lineData1.getPlotLine().getDotLabelPaint().setTextAlign(Align.LEFT);
    LinkedList<Double> dataSeriesB = new LinkedList<Double>();
    dataSeriesB.add((double) 30);
    dataSeriesB.add((double) 20);
    dataSeriesB.add((double) 35);
    dataSeriesB.add((double) 30);
    dataSeriesB.add((double) 40);
    RadarData lineData2 = new RadarData("短期目标", dataSeriesB, Color.rgb(75, 166, 51), XEnum.DataAreaStyle.STROKE);
    //lineData2.setDotStyle(XEnum.DotStyle.RING);				
    lineData2.getPlotLine().getDotPaint().setColor(Color.BLACK);
    LinkedList<Double> dataSeriesC = new LinkedList<Double>();
    dataSeriesC.add(40d);
    dataSeriesC.add(30d);
    dataSeriesC.add(40d);
    dataSeriesC.add(35d);
    dataSeriesC.add(45d);
    RadarData lineData3 = new RadarData("长期目标", dataSeriesC, Color.rgb(224, 53, 49), XEnum.DataAreaStyle.STROKE);
    lineData3.setLineStyle(XEnum.LineStyle.DASH);
    lineData3.getPlotLine().setDotStyle(XEnum.DotStyle.RING);
    chartData.add(lineData1);
    chartData.add(lineData2);
    chartData.add(lineData3);
}
Also used : RadarData(org.xclcharts.chart.RadarData) LinkedList(java.util.LinkedList)

Example 3 with RadarData

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

the class RadarChart02View method chartDataSet.

private void chartDataSet() {
    LinkedList<Double> dataSeriesA = new LinkedList<Double>();
    dataSeriesA.add(20d);
    dataSeriesA.add(10d);
    dataSeriesA.add(30d);
    dataSeriesA.add(25d);
    dataSeriesA.add(60d);
    dataSeriesA.add(70d);
    dataSeriesA.add(80d);
    dataSeriesA.add(90d);
    RadarData lineData1 = new RadarData("笨蛋一号", dataSeriesA, Color.rgb(234, 83, 71), XEnum.DataAreaStyle.FILL);
    lineData1.setLabelVisible(true);
    lineData1.getPlotLine().getDotLabelPaint().setTextAlign(Align.LEFT);
    LinkedList<Double> dataSeriesB = new LinkedList<Double>();
    dataSeriesB.add(50d);
    dataSeriesB.add(60d);
    dataSeriesB.add(70d);
    dataSeriesB.add(40d);
    dataSeriesB.add(80d);
    dataSeriesB.add(75d);
    dataSeriesB.add(60d);
    dataSeriesB.add(50d);
    RadarData lineData2 = new RadarData("笨蛋二号", dataSeriesB, Color.rgb(75, 166, 51), XEnum.DataAreaStyle.STROKE);
    lineData2.setLineStyle(XEnum.LineStyle.SOLID);
    lineData2.getPlotLine().getDotPaint().setColor(Color.RED);
    lineData2.getPlotLine().setDotStyle(XEnum.DotStyle.RING);
    lineData2.getPlotLine().getLinePaint().setColor(Color.rgb(31, 59, 123));
    LinkedList<Double> dataSeriesC = new LinkedList<Double>();
    dataSeriesC.add(40d);
    dataSeriesC.add(30d);
    dataSeriesC.add(40d);
    dataSeriesC.add(35d);
    dataSeriesC.add(45d);
    dataSeriesC.add(55d);
    dataSeriesC.add(70d);
    dataSeriesC.add(85d);
    RadarData lineData3 = new RadarData("笨蛋三号", dataSeriesC, Color.rgb(224, 53, 49), XEnum.DataAreaStyle.STROKE);
    lineData3.setLineStyle(XEnum.LineStyle.SOLID);
    lineData3.getPlotLine().setDotStyle(XEnum.DotStyle.PRISMATIC);
    chartData.add(lineData1);
    chartData.add(lineData2);
    chartData.add(lineData3);
}
Also used : RadarData(org.xclcharts.chart.RadarData) LinkedList(java.util.LinkedList)

Example 4 with RadarData

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

the class RadarChart02View method triggerClick.

//触发监听
private void triggerClick(float x, float y) {
    PointPosition record = chart.getPositionRecord(x, y);
    if (null == record)
        return;
    if (record.getDataID() < chartData.size()) {
        RadarData lData = chartData.get(record.getDataID());
        Double lValue = lData.getLinePoint().get(record.getDataChildID());
        Toast.makeText(this.getContext(), " Current Value:" + Double.toString(lValue) + " Point info:" + record.getPointInfo(), Toast.LENGTH_SHORT).show();
    }
}
Also used : RadarData(org.xclcharts.chart.RadarData) PointPosition(org.xclcharts.event.click.PointPosition)

Example 5 with RadarData

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

the class PlotLegendRender method convertArrayRadarKey.

private void convertArrayRadarKey(List<RadarData> dataSet) {
    if (null == dataSet)
        return;
    String key = "";
    for (RadarData cData : dataSet) {
        key = cData.getLineKey();
        if (!isDrawKey(key))
            continue;
        if ("" == key)
            continue;
        mLstKey.add(key);
        mLstColor.add(cData.getLineColor());
        mLstDotStyle.add(cData.getPlotLine().getPlotDot());
    }
}
Also used : RadarData(org.xclcharts.chart.RadarData)

Aggregations

RadarData (org.xclcharts.chart.RadarData)5 LinkedList (java.util.LinkedList)2 PointPosition (org.xclcharts.event.click.PointPosition)2